|
| 1 | +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | + |
| 3 | +Date: Mon, 22 Jan 2024 11:41:13 +0800 |
| 4 | +Subject: [PATCH] Renewable sponges |
| 5 | + |
| 6 | + |
| 7 | +diff --git a/src/main/java/net/minecraft/world/entity/monster/Guardian.java b/src/main/java/net/minecraft/world/entity/monster/Guardian.java |
| 8 | +index fd41ef66e2e12ec3a888bb376ef4363343914fcd..2719623d856ad33fa1164c566fddd8bd24dfc8bd 100644 |
| 9 | +--- a/src/main/java/net/minecraft/world/entity/monster/Guardian.java |
| 10 | ++++ b/src/main/java/net/minecraft/world/entity/monster/Guardian.java |
| 11 | +@@ -364,6 +364,30 @@ public class Guardian extends Monster { |
| 12 | + return new Vector3f(0.0F, dimensions.height + 0.125F * scaleFactor, 0.0F); |
| 13 | + } |
| 14 | + |
| 15 | ++ // Leaves start - renewable sponges |
| 16 | ++ |
| 17 | ++ @Override |
| 18 | ++ public void thunderHit(net.minecraft.server.level.ServerLevel world, net.minecraft.world.entity.LightningBolt lightning) { |
| 19 | ++ if (top.leavesmc.leaves.LeavesConfig.renewableSponges && !this.isRemoved() && !(this instanceof ElderGuardian)) { |
| 20 | ++ ElderGuardian elderGuardian = new ElderGuardian(EntityType.ELDER_GUARDIAN ,this.level()); |
| 21 | ++ elderGuardian.moveTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), this.getXRot()); |
| 22 | ++ elderGuardian.finalizeSpawn(world ,this.level().getCurrentDifficultyAt(elderGuardian.blockPosition()), MobSpawnType.CONVERSION, null, null); |
| 23 | ++ elderGuardian.setNoAi(this.isNoAi()); |
| 24 | ++ |
| 25 | ++ if (this.hasCustomName()) { |
| 26 | ++ elderGuardian.setCustomName(this.getCustomName()); |
| 27 | ++ elderGuardian.setCustomNameVisible(this.isCustomNameVisible()); |
| 28 | ++ } |
| 29 | ++ |
| 30 | ++ this.level().addFreshEntity(elderGuardian); |
| 31 | ++ this.discard(); |
| 32 | ++ } else { |
| 33 | ++ super.thunderHit(world, lightning); |
| 34 | ++ } |
| 35 | ++ } |
| 36 | ++ |
| 37 | ++ // Leaves end - renewable sponges |
| 38 | ++ |
| 39 | + private static class GuardianMoveControl extends MoveControl { |
| 40 | + |
| 41 | + private final Guardian guardian; |
0 commit comments