Skip to content

Commit

Permalink
Add configurable movement speed for more entities
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Jan 2, 2024
1 parent d991940 commit df715cf
Show file tree
Hide file tree
Showing 2 changed files with 198 additions and 55 deletions.
198 changes: 198 additions & 0 deletions patches/server/0042-Configurable-movement-speed-of-more-entities.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
Date: Sun, 17 Dec 2023 19:34:46 -0500
Subject: [PATCH] Configurable movement speed of more entities


diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
index 3556f9a37d6a4790f9311e1004d32156aff541e2..232c6a456298c56f8ce7665705d766a874738b63 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java
@@ -89,6 +89,7 @@ public class Drowned extends Zombie implements RangedAttackMob {
@Override
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.drownedMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.drownedMovementSpeed); // Leaf - Configurable drowned movement speed
}

@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java
index 06a5106a94a44c1d21537410d801cdd945503d69..be8e667841f7e4b9f9b261c90dc05c6a775ae226 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Husk.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java
@@ -12,6 +12,7 @@ import net.minecraft.world.entity.EntityDimensions;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.MobSpawnType;
+import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
@@ -45,6 +46,7 @@ public class Husk extends Zombie {
@Override
public void initAttributes() {
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.huskMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.huskMovementSpeed); // Leaf - Configurable husk movement speed
}

@Override
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 007e75ec5a6a8f1522e7f0d105507834028eb819..cd3f64e88e1f0a600c19e9a0940442c912360332 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -128,6 +128,7 @@ public class Zombie extends Monster {
@Override
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombieMovementSpeed); // Leaf - Configurable zombie movement speed
}

public boolean jockeyOnlyBaby() {
@@ -185,9 +186,15 @@ public class Zombie extends Monster {
this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR));
}

+ // Leaf start - Configurable zombie movement speed
public static AttributeSupplier.Builder createAttributes() {
- return Monster.createMonsterAttributes().add(Attributes.FOLLOW_RANGE, 35.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D).add(Attributes.ATTACK_DAMAGE, 3.0D).add(Attributes.ARMOR, 2.0D).add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
+ return Monster.createMonsterAttributes()
+ .add(Attributes.FOLLOW_RANGE, 35.0D)
+ .add(Attributes.ATTACK_DAMAGE, 3.0D)
+ .add(Attributes.ARMOR, 2.0D)
+ .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE);
}
+ // Leaf end

@Override
protected void defineSynchedData() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
index d8731350ca97de34b256ccf44e08e32037ed527e..91b73e4ae6e556d37700706e9f5cee03d0d371a2 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -27,6 +27,7 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.MobSpawnType;
import net.minecraft.world.entity.SpawnGroupData;
+import net.minecraft.world.entity.ai.attributes.Attributes;
import net.minecraft.world.entity.ai.village.ReputationEventType;
import net.minecraft.world.entity.npc.Villager;
import net.minecraft.world.entity.npc.VillagerData;
@@ -102,6 +103,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
@Override
public void initAttributes() {
this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieVillagerMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombieVillagerMovementSpeed); // Leaf - Configurable zombieVillager movement speed
}

@Override
diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
index df8c7a45eb49a8c667030eb67d6d49dcbaef4fcf..6a534272546b19a75880940f39458ca69b0d1653 100644
--- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java
@@ -84,6 +84,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
@Override
public void initAttributes() {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombifiedPiglinMaxHealth);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.zombifiedPiglinMovementSpeed); // Leaf - Configurable zombifiedPiglin movement speed
}

@Override
@@ -125,9 +126,13 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
this.targetSelector.addGoal(3, new ResetUniversalAngerTargetGoal<>(this, true));
}

+ // Leaf start - Configurable zombieVillager movement speed
public static AttributeSupplier.Builder createAttributes() {
- return Zombie.createAttributes().add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0D).add(Attributes.MOVEMENT_SPEED, 0.23000000417232513D).add(Attributes.ATTACK_DAMAGE, 5.0D);
+ return Zombie.createAttributes()
+ .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0D)
+ .add(Attributes.ATTACK_DAMAGE, 5.0D);
}
+ // Leaf end

@Override
protected float getStandingEyeHeight(Pose pose, EntityDimensions dimensions) {
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 22a61c89007e624586e7ed518f0aa18372bc4593..609446782958d03ae0d5bef99c1d8e5320dfa037 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1535,6 +1535,7 @@ public class PurpurWorldConfig {
public boolean drownedTakeDamageFromWater = false;
public boolean drownedBreakDoors = false;
public boolean drownedAlwaysDropExp = false;
+ public double drownedMovementSpeed = 0.23000000417232513D; // Leaf - Configurable drowned movement speed
private void drownedSettings() {
drownedRidable = getBoolean("mobs.drowned.ridable", drownedRidable);
drownedRidableInWater = getBoolean("mobs.drowned.ridable-in-water", drownedRidableInWater);
@@ -1552,6 +1553,7 @@ public class PurpurWorldConfig {
drownedTakeDamageFromWater = getBoolean("mobs.drowned.takes-damage-from-water", drownedTakeDamageFromWater);
drownedBreakDoors = getBoolean("mobs.drowned.can-break-doors", drownedBreakDoors);
drownedAlwaysDropExp = getBoolean("mobs.drowned.always-drop-exp", drownedAlwaysDropExp);
+ drownedMovementSpeed = getDouble("mobs.drowned.movement-speed", drownedMovementSpeed); // Leaf - Configurable drowned movement speed
}

public boolean elderGuardianRidable = false;
@@ -1898,6 +1900,7 @@ public class PurpurWorldConfig {
public boolean huskJockeyTryExistingChickens = true;
public boolean huskTakeDamageFromWater = false;
public boolean huskAlwaysDropExp = false;
+ public double huskMovementSpeed = 0.23000000417232513D; // Leaf - Configurable husk movement speed
private void huskSettings() {
huskRidable = getBoolean("mobs.husk.ridable", huskRidable);
huskRidableInWater = getBoolean("mobs.husk.ridable-in-water", huskRidableInWater);
@@ -1914,6 +1917,7 @@ public class PurpurWorldConfig {
huskJockeyTryExistingChickens = getBoolean("mobs.husk.jockey.try-existing-chickens", huskJockeyTryExistingChickens);
huskTakeDamageFromWater = getBoolean("mobs.husk.takes-damage-from-water", huskTakeDamageFromWater);
huskAlwaysDropExp = getBoolean("mobs.husk.always-drop-exp", huskAlwaysDropExp);
+ huskMovementSpeed = getDouble("mobs.husk.movement-speed", huskMovementSpeed); // Leaf - Configurable husk movement speed
}

public boolean illusionerRidable = false;
@@ -3126,6 +3130,7 @@ public class PurpurWorldConfig {
public boolean zombieTakeDamageFromWater = false;
public boolean zombieAlwaysDropExp = false;
public double zombieHeadVisibilityPercent = 0.5D;
+ public double zombieMovementSpeed = 0.23000000417232513D; // Leaf - Configurable zombie movement speed
private void zombieSettings() {
zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable);
zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater);
@@ -3145,6 +3150,7 @@ public class PurpurWorldConfig {
zombieTakeDamageFromWater = getBoolean("mobs.zombie.takes-damage-from-water", zombieTakeDamageFromWater);
zombieAlwaysDropExp = getBoolean("mobs.zombie.always-drop-exp", zombieAlwaysDropExp);
zombieHeadVisibilityPercent = getDouble("mobs.zombie.head-visibility-percent", zombieHeadVisibilityPercent);
+ zombieMovementSpeed = getDouble("mobs.zombie.movement-speed", zombieMovementSpeed); // Leaf - Configurable zombie movement speed
}

public boolean zombieHorseRidable = false;
@@ -3193,6 +3199,7 @@ public class PurpurWorldConfig {
public int zombieVillagerCuringTimeMax = 6000;
public boolean zombieVillagerCureEnabled = true;
public boolean zombieVillagerAlwaysDropExp = false;
+ public double zombieVillagerMovementSpeed = 0.23000000417232513D; // Leaf - Configurable zombieVillager movement speed
private void zombieVillagerSettings() {
zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable);
zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater);
@@ -3212,6 +3219,7 @@ public class PurpurWorldConfig {
zombieVillagerCuringTimeMax = getInt("mobs.zombie_villager.curing_time.max", zombieVillagerCuringTimeMax);
zombieVillagerCureEnabled = getBoolean("mobs.zombie_villager.cure.enabled", zombieVillagerCureEnabled);
zombieVillagerAlwaysDropExp = getBoolean("mobs.zombie_villager.always-drop-exp", zombieVillagerAlwaysDropExp);
+ zombieVillagerMovementSpeed = getDouble("mobs.zombie_villager.movement-speed", zombieVillagerMovementSpeed); // Leaf - Configurable zombieVillager movement speed
}

public boolean zombifiedPiglinRidable = false;
@@ -3225,6 +3233,7 @@ public class PurpurWorldConfig {
public boolean zombifiedPiglinCountAsPlayerKillWhenAngry = true;
public boolean zombifiedPiglinTakeDamageFromWater = false;
public boolean zombifiedPiglinAlwaysDropExp = false;
+ public double zombifiedPiglinMovementSpeed = 0.23000000417232513D; // Leaf - Configurable zombifiedPiglin movement speed
private void zombifiedPiglinSettings() {
zombifiedPiglinRidable = getBoolean("mobs.zombified_piglin.ridable", zombifiedPiglinRidable);
zombifiedPiglinRidableInWater = getBoolean("mobs.zombified_piglin.ridable-in-water", zombifiedPiglinRidableInWater);
@@ -3242,6 +3251,7 @@ public class PurpurWorldConfig {
zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry);
zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater);
zombifiedPiglinAlwaysDropExp = getBoolean("mobs.zombified_piglin.always-drop-exp", zombifiedPiglinAlwaysDropExp);
+ zombifiedPiglinMovementSpeed = getDouble("mobs.zombified_piglin.movement-speed", zombifiedPiglinMovementSpeed); // Leaf - Configurable zombifiedPiglin movement speed
}

public float hungerStarvationDamage = 1.0F;
55 changes: 0 additions & 55 deletions patches/server/0042-Configurable-zombie-movement-speed.patch

This file was deleted.

0 comments on commit df715cf

Please sign in to comment.