PaperMC/patches/server/0020-Configurable-baby-zombie-movement-speed.patch

31 lines
2.3 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
2023-09-21 21:54:46 +02:00
index 883a5c7d0c842dc3c497ccd0694a77733bafeb16..9d760f3745efc1248b7817d580e5ceb451fc4096 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
2023-09-21 21:54:46 +02:00
@@ -78,6 +78,7 @@ public class Zombie extends Monster {
2021-06-11 14:02:28 +02:00
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);
2023-06-08 00:28:06 +02:00
+ private final AttributeModifier babyModifier = new net.minecraft.world.entity.ai.attributes.AttributeModifier(SPEED_MODIFIER_BABY.getId(), SPEED_MODIFIER_BABY.getName(), this.level().paperConfig().entities.behavior.babyZombieMovementModifier, SPEED_MODIFIER_BABY.getOperation()); // Paper - Make baby speed configurable
2021-06-11 14:02:28 +02:00
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);
2023-09-21 21:54:46 +02:00
@@ -186,9 +187,9 @@ public class Zombie extends Monster {
2023-06-07 20:31:32 +02:00
if (this.level() != null && !this.level().isClientSide) {
2021-06-11 14:02:28 +02:00
AttributeInstance attributemodifiable = this.getAttribute(Attributes.MOVEMENT_SPEED);
2023-09-21 21:54:46 +02:00
- attributemodifiable.removeModifier(Zombie.SPEED_MODIFIER_BABY.getId());
+ attributemodifiable.removeModifier(this.babyModifier.getId()); // Paper
2021-06-11 14:02:28 +02:00
if (baby) {
- attributemodifiable.addTransientModifier(Zombie.SPEED_MODIFIER_BABY);
+ attributemodifiable.addTransientModifier(this.babyModifier); // Paper
}
}