From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 1 Mar 2016 13:09:16 -0600 Subject: [PATCH] Configurable baby zombie movement speed diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java index d97288b27668e0544b05ce110bfc6a0834cc263d..29f35535fab41aee6d253de9f9bd566d0fc28d65 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -74,4 +74,15 @@ public class PaperWorldConfig { log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight); } + + public double babyZombieMovementModifier; + private void babyZombieMovementModifier() { + babyZombieMovementModifier = getDouble("baby-zombie-movement-modifier", 0.5D); + if (PaperConfig.version < 20) { + babyZombieMovementModifier = getDouble("baby-zombie-movement-speed", 0.5D); + set("baby-zombie-movement-modifier", babyZombieMovementModifier); + } + + log("Baby zombies will move at the speed of " + babyZombieMovementModifier); + } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index a3f608e3a06abfa4268278b6f1298ece36264a02..d07847876e22971b4a90f67d8281bf08361424e0 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -21,7 +21,7 @@ import org.bukkit.event.entity.EntityTransformEvent; public class EntityZombie extends EntityMonster { private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); - private static final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); + private final AttributeModifier c = new AttributeModifier(EntityZombie.b, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.c; // Paper - remove static - Make baby speed configurable private static final DataWatcherObject d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); public static final DataWatcherObject DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); @@ -124,9 +124,9 @@ public class EntityZombie extends EntityMonster { if (this.world != null && !this.world.isClientSide) { AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); - attributemodifiable.removeModifier(EntityZombie.c); + attributemodifiable.removeModifier(this.babyModifier); // Paper if (flag) { - attributemodifiable.b(EntityZombie.c); + attributemodifiable.b(this.babyModifier); // Paper } }