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

Paper Changes:
PaperMC/Paper@6b0b29a9 Update publishing endpoint
PaperMC/Paper@f6fabc5f Call EntityChangeBlockEvent for copper golem statue changes (#13090)
PaperMC/Paper@1d6ee7db Update adventure
PaperMC/Paper@404e49fd Update to 1.21.9-rc1
PaperMC/Paper@40552742 Fix empty SkinPatch initialization and swapped dynamic/static heuristic in ResolvableProfile build method
2025-09-25 21:56:16 -07: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/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java
index 453f9d6e9581165c59b959ea6bccc5387dff91bd..ee13dd20af2730f3051f77fb0e73ce5c8253bd4a 100644
--- a/net/minecraft/world/entity/monster/Drowned.java
+++ b/net/minecraft/world/entity/monster/Drowned.java
@@ -106,6 +106,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/Husk.java b/net/minecraft/world/entity/monster/Husk.java
index 4a617bb6bc3675d8cb42be0b5ae19befd4b3176f..557b2d684936c15299d7082a92ec8b08e7fab9a5 100644
--- a/net/minecraft/world/entity/monster/Husk.java
+++ b/net/minecraft/world/entity/monster/Husk.java
@@ -49,6 +49,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
+
public static boolean checkHuskSpawnRules(
EntityType<Husk> entityType, ServerLevelAccessor level, EntitySpawnReason spawnReason, BlockPos pos, RandomSource random
) {
diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java
index 4f5d19c19887dc543c336bb72dac76c82503f792..73b6ffd6a1f27a5d49125b51d3396df5d84493f6 100644
--- a/net/minecraft/world/entity/monster/Zombie.java
+++ b/net/minecraft/world/entity/monster/Zombie.java
@@ -127,6 +127,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
@@ -556,19 +570,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);
@@ -577,6 +590,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/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java
index 706c0cc803ede18f0790e94cfc989f0676199e7a..1d01131dae3900280d5c9ce9899f4afa09acfd46 100644
--- a/net/minecraft/world/entity/monster/ZombieVillager.java
+++ b/net/minecraft/world/entity/monster/ZombieVillager.java
@@ -102,6 +102,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/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java
index a6244a3d5d8e48b81147d6aed7ac1126e9ae5d64..325d0f32fd8824dc1c7067eb9c303bdfc122c706 100644
--- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java
+++ b/net/minecraft/world/entity/monster/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
public void setPersistentAngerTarget(@Nullable UUID target) {
this.persistentAngerTarget = target;