Files
Purpur/purpur-server/minecraft-patches/features/0009-Configurable-jockey-options.patch
granny 712e1c3f72 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a2c9f58a Update to 1.21.11-pre3 (#13194)
PaperMC/Paper@168287b2 Update exact choice recipe patch (#13346)
PaperMC/Paper@354a5d54 [ci/skip] Add missing Nullable annotation for KineticWeapon.Builder methods (#13347)
PaperMC/Paper@df4b6681 Restore legacy command restrictions
PaperMC/Paper@2efb4e7a Merge branch 'ver/1.21.10'
PaperMC/Paper@fdfdec66 Trigger build after merge commit
PaperMC/Paper@6348ac89 Schedule PlayerSpawnFinder chunk callbacks to mainThreadProcessor instead of server queue fixes #13354
PaperMC/Paper@b786cbe8 Update to 1.21.11-pre4 (#13357)
PaperMC/Paper@889c6617 Flush region storage if configured for ChunkMap#synchronize
PaperMC/Paper@c7a138b0 Remove ItemStack mutation on drop methods (#11831)
PaperMC/Paper@1d09b617 Fix ItemType#isEdible to also check for DataComponents#CONSUMABLE (#13348)
PaperMC/Paper@84a789b2 Add Decorated Pot wobble API (#12994)
PaperMC/Paper@ec0ad8b9 Update to 1.21.11-pre5
PaperMC/Paper@ffce96cf Fix wrong translation key in /give command (#13364)
PaperMC/Paper@1cb31fd3 Update to 1.21.11-rc1
PaperMC/Paper@51c1b16b Optimize getEntityCount by directly accessing Moonrise data structures
2025-12-04 19:39:48 -08:00

178 lines
7.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Thu, 26 Mar 2020 21:39:32 -0500
Subject: [PATCH] Configurable jockey options
diff --git a/net/minecraft/world/entity/monster/zombie/Drowned.java b/net/minecraft/world/entity/monster/zombie/Drowned.java
index 0b6d2bcec8506686eb6e0aaeb14870c14bd84e9d..3b1e3e7c1218cbfdfe48db3fad15280f43fd3311 100644
--- a/net/minecraft/world/entity/monster/zombie/Drowned.java
+++ b/net/minecraft/world/entity/monster/zombie/Drowned.java
@@ -109,6 +109,23 @@ public class Drowned extends Zombie implements RangedAttackMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.drownedJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.drownedJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.drownedJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void addBehaviourGoals() {
this.goalSelector.addGoal(1, new Drowned.DrownedGoToWaterGoal(this, 1.0));
diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java
index 03270138e6fae7ee28f958cafee5b74b18dce355..d31145fee0f646d734e90199288b29f07854d066 100644
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
@@ -58,6 +58,23 @@ public class Husk extends Zombie {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.huskJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.huskJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.huskJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
public boolean isSunSensitive() {
return false;
diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java
index d873ca9873e95f3a5869cb63a93b0643a9c867dc..638642628c3dc9fa25d25c589029219c23d1e602 100644
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
@@ -128,6 +128,20 @@ public class Zombie extends Monster {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.zombieJockeyOnlyBaby;
+ }
+
+ public double jockeyChance() {
+ return level().purpurConfig.zombieJockeyChance;
+ }
+
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.zombieJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void registerGoals() {
this.goalSelector.addGoal(0, new org.purpurmc.purpur.entity.ai.HasRider(this)); // Purpur - Ridables
@@ -531,19 +545,18 @@ public class Zombie extends Monster {
}
if (spawnGroupData instanceof Zombie.ZombieGroupData zombieGroupData) {
- if (zombieGroupData.isBaby) {
- this.setBaby(true);
+ if (!jockeyOnlyBaby() || zombieGroupData.isBaby) { // Purpur - Configurable jockey options
+ this.setBaby(zombieGroupData.isBaby); // Purpur - Configurable jockey options
if (zombieGroupData.canSpawnJockey) {
- if (random.nextFloat() < 0.05) {
- List<Chicken> entitiesOfClass = level.getEntitiesOfClass(
+ if (random.nextFloat() < jockeyChance()) { // Purpur - Configurable jockey options
+ List<Chicken> entitiesOfClass = jockeyTryExistingChickens() ? level.getEntitiesOfClass( // Purpur - Configurable jockey options
Chicken.class, this.getBoundingBox().inflate(5.0, 3.0, 5.0), EntitySelector.ENTITY_NOT_BEING_RIDDEN
- );
+ ) : java.util.Collections.emptyList(); // Purpur - Configurable jockey options
if (!entitiesOfClass.isEmpty()) {
Chicken chicken = entitiesOfClass.get(0);
chicken.setChickenJockey(true);
this.startRiding(chicken, false, false);
- }
- } else if (random.nextFloat() < 0.05) {
+ } else { // Purpur - Configurable jockey options
Chicken chicken1 = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.JOCKEY);
if (chicken1 != null) {
chicken1.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
@@ -552,6 +565,7 @@ public class Zombie extends Monster {
this.startRiding(chicken1, false, false);
level.addFreshEntity(chicken1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT); // CraftBukkit
}
+ } // Purpur - Configurable jockey options
}
}
}
diff --git a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
index 0a02684ec00540b91a2a68e5787e51d15b3743a7..62f55763d95e496da8b8fcf7d95752777e323b48 100644
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
@@ -114,6 +114,23 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.zombieVillagerJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.zombieVillagerJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.zombieVillagerJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder);
diff --git a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
index 3ff8c95075f9d25c3a2e4160ee6d18057838a7b5..ec39ad6740361774f9ecfda7186cab9d8fac90f2 100644
--- a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
@@ -89,6 +89,23 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Configurable jockey options
+ @Override
+ public boolean jockeyOnlyBaby() {
+ return level().purpurConfig.zombifiedPiglinJockeyOnlyBaby;
+ }
+
+ @Override
+ public double jockeyChance() {
+ return level().purpurConfig.zombifiedPiglinJockeyChance;
+ }
+
+ @Override
+ public boolean jockeyTryExistingChickens() {
+ return level().purpurConfig.zombifiedPiglinJockeyTryExistingChickens;
+ }
+ // Purpur end - Configurable jockey options
+
@Override
protected void addBehaviourGoals() {
this.goalSelector.addGoal(1, new SpearUseGoal<>(this, 1.0, 1.0, 10.0F, 2.0F));