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 098bd3fba867c0e4c6c58748aa6e2e632737a948..912611cf1aeccf5a82a789aab07d76723d4357cc 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -73,4 +73,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 5bc0a591ab359785e46648604000eac116e7e37e..b808477cea6bf704edfaf08a2d0366bf263e69aa 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 bv = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); public static final DataWatcherObject DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); @@ -123,9 +123,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 } }