Skip to content

Commit

Permalink
adds ridable option to zombie horse and skeleton horse, fixes #1458
Browse files Browse the repository at this point in the history
only set as tamable if already tamed or if ridable option is enabled
  • Loading branch information
granny committed Nov 14, 2023
1 parent 1adf78b commit 2a38801
Show file tree
Hide file tree
Showing 41 changed files with 309 additions and 301 deletions.
16 changes: 10 additions & 6 deletions patches/server/0008-Ridables.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2647,7 +2647,7 @@ index a6601f70890f90691923c0e6a9f10ea597ccabc2..ae7bcfa608d8bdd2a2320618225294de
protected SoundEvent getAmbientSound() {
return SoundEvents.MULE_AMBIENT;
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
index 92d170dd0155a7a5879de4a320cdc03bb66d8887..6d5a37facc288ebb27d96c2451091ea299c16077 100644
index 92d170dd0155a7a5879de4a320cdc03bb66d8887..0318297ed96a640932728d704fa273c4d126e034 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
@@ -31,6 +31,13 @@ public class SkeletonHorse extends AbstractHorse {
Expand All @@ -2657,7 +2657,7 @@ index 92d170dd0155a7a5879de4a320cdc03bb66d8887..6d5a37facc288ebb27d96c2451091ea2
+ // Purpur start
+ @Override
+ public boolean isTamed() {
+ return true;
+ return super.isTamed() || this.level().purpurConfig.skeletonHorseRidable;
+ }
+ // Purpur end
+
Expand Down Expand Up @@ -2706,7 +2706,7 @@ index b016f53c6644c6411b3a91e09049892131187179..5fc37e2322188e0db12f7679e40b1a3d
public boolean isTraderLlama() {
return true;
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
index 7f8bbacf00498a2ed6a13760266df993a289c2dd..6c03ad3d978378221db3e5bed947738bd710eae0 100644
index 7f8bbacf00498a2ed6a13760266df993a289c2dd..8c5a083f3db046709a38355343ad7e5ab45779b5 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
@@ -22,6 +22,18 @@ public class ZombieHorse extends AbstractHorse {
Expand All @@ -2721,7 +2721,7 @@ index 7f8bbacf00498a2ed6a13760266df993a289c2dd..6c03ad3d978378221db3e5bed947738b
+
+ @Override
+ public boolean isTamed() {
+ return true;
+ return super.isTamed() || this.level().purpurConfig.zombieHorseRidable;
+ }
+ // Purpur end
+
Expand Down Expand Up @@ -5281,10 +5281,10 @@ index 61d193d8ddd87817bf2c560037d42366cff1eca9..8ad548fc059568d37675e017548b171d
+ }
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 5f0732c2b8f85185b6dfc1db3119c22e8be7f5da..4c25461a6d75a47425b66e04285792787d7193ee 100644
index 5f0732c2b8f85185b6dfc1db3119c22e8be7f5da..3eae97d610d8f61528b87039723ef4ce2dc75c91 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -89,4 +89,722 @@ public class PurpurWorldConfig {
@@ -89,4 +89,726 @@ public class PurpurWorldConfig {
final Map<String, Object> value = PurpurConfig.getMap("world-settings." + worldName + "." + path, null);
return value.isEmpty() ? fallback : value;
}
Expand Down Expand Up @@ -5775,9 +5775,11 @@ index 5f0732c2b8f85185b6dfc1db3119c22e8be7f5da..4c25461a6d75a47425b66e0428579278
+ skeletonControllable = getBoolean("mobs.skeleton.controllable", skeletonControllable);
+ }
+
+ public boolean skeletonHorseRidable = false;
+ public boolean skeletonHorseRidableInWater = true;
+ public boolean skeletonHorseCanSwim = false;
+ private void skeletonHorseSettings() {
+ skeletonHorseRidable = getBoolean("mobs.skeleton_horse.ridable", skeletonHorseRidable);
+ skeletonHorseRidableInWater = getBoolean("mobs.skeleton_horse.ridable-in-water", skeletonHorseRidableInWater);
+ skeletonHorseCanSwim = getBoolean("mobs.skeleton_horse.can-swim", skeletonHorseCanSwim);
+ }
Expand Down Expand Up @@ -5982,9 +5984,11 @@ index 5f0732c2b8f85185b6dfc1db3119c22e8be7f5da..4c25461a6d75a47425b66e0428579278
+ zombieControllable = getBoolean("mobs.zombie.controllable", zombieControllable);
+ }
+
+ public boolean zombieHorseRidable = false;
+ public boolean zombieHorseRidableInWater = false;
+ public boolean zombieHorseCanSwim = false;
+ private void zombieHorseSettings() {
+ zombieHorseRidable = getBoolean("mobs.zombie_horse.ridable", zombieHorseRidable);
+ zombieHorseRidableInWater = getBoolean("mobs.zombie_horse.ridable-in-water", zombieHorseRidableInWater);
+ zombieHorseCanSwim = getBoolean("mobs.zombie_horse.can-swim", zombieHorseCanSwim);
+ }
Expand Down
26 changes: 15 additions & 11 deletions patches/server/0009-Configurable-entity-base-attributes.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable entity base attributes


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index de2a1621b2d671de8f1c10463661cb361cd9e6b4..120377f090669ef06ad6d53fa55facfb9e1e800a 100644
index 9501683d6a6239e7a053f9a40a377783232bbe8e..8b9efc0477f1d97414d12282bd9d10a7d2ec83a8 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -156,7 +156,7 @@ import org.bukkit.plugin.PluginManager;
Expand Down Expand Up @@ -238,7 +238,7 @@ index 66f80ec010909648278c4e74c80d3766b9cf6c6a..14daac1a87e32e0ff0a610aef256e20c
return (Boolean) this.entityData.get(Ocelot.DATA_TRUSTING);
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Panda.java b/src/main/java/net/minecraft/world/entity/animal/Panda.java
index 5b3a2010da3b6429da783f8263fd170a4fb8d80b..2832d7cbcfad43b3f0f6c33504cff68add85601d 100644
index 61af090813936bac334a487c21e9e67f80a4c413..6c7354ca03efdaf9e01d4a63f8ac38e74c0c35c8 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Panda.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Panda.java
@@ -140,6 +140,12 @@ public class Panda extends Animal {
Expand Down Expand Up @@ -475,7 +475,7 @@ index d1dd2cda473bb2294dc10c66c13eac8591ea4d5b..5cd79df01d4dbe7a1af530c502a78e48
public Map<String, Vector3f> getModelRotationValues() {
return this.modelRotationValues;
diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
index 29108c481756d3150fd0ae69f6d249d127b11fdd..85a557b50498bb83eeec4125aa2ae14f3bfaaab8 100644
index 02d19eaa4599951dd8a8fe594946c8a3dc5b30a9..909d32553ffd7a32f44f7201fdab850e4bcfdcc7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
+++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java
@@ -320,6 +320,23 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl
Expand Down Expand Up @@ -503,7 +503,7 @@ index 29108c481756d3150fd0ae69f6d249d127b11fdd..85a557b50498bb83eeec4125aa2ae14f
protected SoundEvent getAmbientSound() {
return SoundEvents.CAMEL_AMBIENT;
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 27050c00ea4e4b301d4c85528117fc1d87e6f1ef..ad4d4e38a2f0125e0943945c9440a9be80b60257 100644
index 73db73bb5b47f586ce32249458268e4b7cda2003..a27e99ee6d8d2406d141dc1537c7098f43a29318 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -162,6 +162,44 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
Expand Down Expand Up @@ -613,7 +613,7 @@ index 3e50581033e88e8eddcbd85bfa890cbe0b88a7e6..92339f5a07dcb6bf7eb1bce6d584464e
protected void randomizeAttributes(RandomSource random) {
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue((double)generateMaxHealth(random::nextInt));
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
index 0549974c56ae7d05b5eec77029c5d08a6614a8bf..278c33b7de4472a746cdbc1faaa68e05592777bc 100644
index cd11879b8ad7977ca9c0c26d9bcc26ac7078a265..8c8c135e9bc707ae8e2aad249302109023f6fea3 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/Llama.java
@@ -124,6 +124,21 @@ public class Llama extends AbstractChestedHorse implements VariantHolder<Llama.V
Expand Down Expand Up @@ -665,7 +665,7 @@ index ae7bcfa608d8bdd2a2320618225294de0314ce53..abbeb305b2d09e9c4c02ade603adac5c
protected SoundEvent getAmbientSound() {
return SoundEvents.MULE_AMBIENT;
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
index 6d5a37facc288ebb27d96c2451091ea299c16077..8ffba7c368f936ea5cdfc46c5fa76c3feb63e1ac 100644
index 0318297ed96a640932728d704fa273c4d126e034..cc8813c572618700981403d513f30b8a06e4c49e 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonHorse.java
@@ -38,6 +38,21 @@ public class SkeletonHorse extends AbstractHorse {
Expand Down Expand Up @@ -717,7 +717,7 @@ index 5fc37e2322188e0db12f7679e40b1a3d40268ca7..4abb9d5fedf63eba9dc3f716d44ea118
public boolean isTraderLlama() {
return true;
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
index 6c03ad3d978378221db3e5bed947738bd710eae0..2e6b55a01e022252245c16ed310920bcba072975 100644
index 8c5a083f3db046709a38355343ad7e5ab45779b5..ebfd54d835cdac3f95c926b3e2e10db6170b4dd7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/ZombieHorse.java
@@ -34,6 +34,21 @@ public class ZombieHorse extends AbstractHorse {
Expand Down Expand Up @@ -1504,7 +1504,7 @@ index 2bed7b373813660139d2322dcd6b83f3015768f0..731bf43e2685554174d7ff295b5561ec
protected void registerGoals() {
this.goalSelector.addGoal(0, new FloatGoal(this));
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b023919b77 100644
index 3eae97d610d8f61528b87039723ef4ce2dc75c91..e248395ad5f5f012aeefecf367d54f90cade0996 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -112,99 +112,190 @@ public class PurpurWorldConfig {
Expand Down Expand Up @@ -2188,7 +2188,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
private void phantomSettings() {
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
@@ -461,189 +806,361 @@ public class PurpurWorldConfig {
@@ -461,191 +806,363 @@ public class PurpurWorldConfig {
phantomFlameDamage = (float) getDouble("mobs.phantom.flames.damage", phantomFlameDamage);
phantomFlameFireTime = getInt("mobs.phantom.flames.fire-time", phantomFlameFireTime);
phantomAllowGriefing = getBoolean("mobs.phantom.allow-griefing", phantomAllowGriefing);
Expand Down Expand Up @@ -2411,6 +2411,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
+ skeletonMaxHealth = getDouble("mobs.skeleton.attributes.max_health", skeletonMaxHealth);
}

public boolean skeletonHorseRidable = false;
public boolean skeletonHorseRidableInWater = true;
public boolean skeletonHorseCanSwim = false;
+ public double skeletonHorseMaxHealthMin = 15.0D;
Expand All @@ -2420,6 +2421,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
+ public double skeletonHorseMovementSpeedMin = 0.2D;
+ public double skeletonHorseMovementSpeedMax = 0.2D;
private void skeletonHorseSettings() {
skeletonHorseRidable = getBoolean("mobs.skeleton_horse.ridable", skeletonHorseRidable);
skeletonHorseRidableInWater = getBoolean("mobs.skeleton_horse.ridable-in-water", skeletonHorseRidableInWater);
skeletonHorseCanSwim = getBoolean("mobs.skeleton_horse.can-swim", skeletonHorseCanSwim);
+ if (PurpurConfig.version < 10) {
Expand Down Expand Up @@ -2550,7 +2552,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
}

public boolean tadpoleRidable = false;
@@ -658,64 +1175,125 @@ public class PurpurWorldConfig {
@@ -660,64 +1177,125 @@ public class PurpurWorldConfig {
public boolean traderLlamaRidable = false;
public boolean traderLlamaRidableInWater = false;
public boolean traderLlamaControllable = true;
Expand Down Expand Up @@ -2676,7 +2678,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
}

public boolean wardenRidable = false;
@@ -730,81 +1308,165 @@ public class PurpurWorldConfig {
@@ -732,83 +1310,167 @@ public class PurpurWorldConfig {
public boolean witchRidable = false;
public boolean witchRidableInWater = true;
public boolean witchControllable = true;
Expand Down Expand Up @@ -2781,6 +2783,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
+ zombieSpawnReinforcements = getDouble("mobs.zombie.attributes.spawn_reinforcements", zombieSpawnReinforcements);
}

public boolean zombieHorseRidable = false;
public boolean zombieHorseRidableInWater = false;
public boolean zombieHorseCanSwim = false;
+ public double zombieHorseMaxHealthMin = 15.0D;
Expand All @@ -2790,6 +2793,7 @@ index 4c25461a6d75a47425b66e04285792787d7193ee..27ce55687c7c59fdfdcc4553240ea8b0
+ public double zombieHorseMovementSpeedMin = 0.2D;
+ public double zombieHorseMovementSpeedMax = 0.2D;
private void zombieHorseSettings() {
zombieHorseRidable = getBoolean("mobs.zombie_horse.ridable", zombieHorseRidable);
zombieHorseRidableInWater = getBoolean("mobs.zombie_horse.ridable-in-water", zombieHorseRidableInWater);
zombieHorseCanSwim = getBoolean("mobs.zombie_horse.can-swim", zombieHorseCanSwim);
+ if (PurpurConfig.version < 10) {
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0025-Zombie-horse-naturally-spawn.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Zombie horse naturally spawn


diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 19698f13530183b3580a7a6ad720d078b6c791ba..c0f11d06e077c41d65b25396a14a4d81a39993e2 100644
index f7a19cdc38feb0dcee3e3cf42610a0604f9f4672..58e0d1a9dedf03029aaedb5d902827f58eaf853e 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1000,10 +1000,18 @@ public class ServerLevel extends Level implements WorldGenLevel {
Expand All @@ -30,18 +30,18 @@ index 19698f13530183b3580a7a6ad720d078b6c791ba..c0f11d06e077c41d65b25396a14a4d81
entityhorseskeleton.setPos((double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ());
this.addFreshEntity(entityhorseskeleton, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); // CraftBukkit
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index b18c498b6fd17ef298cc6ee7b2386188f0b75b36..bae186807d44745942faf8919831f82e475a4f63 100644
index 6d94dc88a470b7e51aafad6c912ff516d114f179..06ea43ddbbaf3165b74303a713f55512b9701765 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1484,6 +1484,7 @@ public class PurpurWorldConfig {
@@ -1487,6 +1487,7 @@ public class PurpurWorldConfig {
public double zombieHorseJumpStrengthMax = 1.0D;
public double zombieHorseMovementSpeedMin = 0.2D;
public double zombieHorseMovementSpeedMax = 0.2D;
+ public double zombieHorseSpawnChance = 0.0D;
private void zombieHorseSettings() {
zombieHorseRidable = getBoolean("mobs.zombie_horse.ridable", zombieHorseRidable);
zombieHorseRidableInWater = getBoolean("mobs.zombie_horse.ridable-in-water", zombieHorseRidableInWater);
zombieHorseCanSwim = getBoolean("mobs.zombie_horse.can-swim", zombieHorseCanSwim);
@@ -1499,6 +1500,7 @@ public class PurpurWorldConfig {
@@ -1503,6 +1504,7 @@ public class PurpurWorldConfig {
zombieHorseJumpStrengthMax = getDouble("mobs.zombie_horse.attributes.jump_strength.max", zombieHorseJumpStrengthMax);
zombieHorseMovementSpeedMin = getDouble("mobs.zombie_horse.attributes.movement_speed.min", zombieHorseMovementSpeedMin);
zombieHorseMovementSpeedMax = getDouble("mobs.zombie_horse.attributes.movement_speed.max", zombieHorseMovementSpeedMax);
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0037-Snowman-drop-and-put-back-pumpkin.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ index 3ffd9dd16c80399842ba138ed60abd66cd312dcb..bd9dd01e9140c2ad0ab9859b9a455f73
this.forceDrops = false; // CraftBukkit
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 92d8babfa6c9a2ba90f7832110bc536e06e6f4f2..63d1acee8006afc72449f9b9dbb6807554dc7285 100644
index 05b7788d168cadb594613d81cbff0726a63d81d2..a48dbad212789f90525e669ea81b1042c53cd06a 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -1174,6 +1174,8 @@ public class PurpurWorldConfig {
@@ -1176,6 +1176,8 @@ public class PurpurWorldConfig {
public boolean snowGolemControllable = true;
public boolean snowGolemLeaveTrailWhenRidden = false;
public double snowGolemMaxHealth = 4.0D;
Expand All @@ -44,7 +44,7 @@ index 92d8babfa6c9a2ba90f7832110bc536e06e6f4f2..63d1acee8006afc72449f9b9dbb68075
private void snowGolemSettings() {
snowGolemRidable = getBoolean("mobs.snow_golem.ridable", snowGolemRidable);
snowGolemRidableInWater = getBoolean("mobs.snow_golem.ridable-in-water", snowGolemRidableInWater);
@@ -1185,6 +1187,8 @@ public class PurpurWorldConfig {
@@ -1187,6 +1189,8 @@ public class PurpurWorldConfig {
set("mobs.snow_golem.attributes.max_health", oldValue);
}
snowGolemMaxHealth = getDouble("mobs.snow_golem.attributes.max_health", snowGolemMaxHealth);
Expand Down
Loading

0 comments on commit 2a38801

Please sign in to comment.