aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0015-Configurable-baby-zombie-movement-speed.patch
blob: ddd91d8735f7707b389b676d5984add860df2563 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
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 3f7ec17466e4fae7139672854e2c8223ada16b76..4d787f0596be1a44724ade309cc00e115778a797 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -113,4 +113,15 @@ public class PaperWorldConfig {
         bambooMinHeight = getInt("max-growth-height.bamboo.min", 11);
         log("Max height for cactus growth " + cactusMaxHeight + ". Max height for reed growth " + reedMaxHeight + ". Max height for bamboo growth " + bambooMaxHeight + ". Min height for fully-grown bamboo " + bambooMinHeight + ".");
     }
+
+    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/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 627aeb45342c2804f911572056a63aa1cb0110e7..953f138b6cd48cc94bc23a4321a9684b4214637e 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -76,7 +76,7 @@ import org.bukkit.event.entity.EntityTransformEvent;
 public class Zombie extends Monster {
 
     private static final UUID SPEED_MODIFIER_BABY_UUID = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
-    private static final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE);
+    private final AttributeModifier SPEED_MODIFIER_BABY = new AttributeModifier(Zombie.SPEED_MODIFIER_BABY_UUID, "Baby speed boost", 0.5D, AttributeModifier.Operation.MULTIPLY_BASE); private final AttributeModifier babyModifier = this.SPEED_MODIFIER_BABY; // Paper - remove static - Make baby speed configurable
     private static final EntityDataAccessor<Boolean> DATA_BABY_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
     private static final EntityDataAccessor<Integer> DATA_SPECIAL_TYPE_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.INT);
     public static final EntityDataAccessor<Boolean> DATA_DROWNED_CONVERSION_ID = SynchedEntityData.defineId(Zombie.class, EntityDataSerializers.BOOLEAN);
@@ -184,9 +184,9 @@ public class Zombie extends Monster {
         if (this.level != null && !this.level.isClientSide) {
             AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
 
-            attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY);
+            attributemodifiable.removeModifier(this.babyModifier); // Paper
             if (baby) {
-                attributemodifiable.addTransientModifier(Zombie.SPEED_MODIFIER_BABY);
+                attributemodifiable.addTransientModifier(this.babyModifier); // Paper
             }
         }