mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-04-19 17:58:15 +02:00
178 lines
7.8 KiB
Diff
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 573abf9eae9f5492e4231d663814352f7e046fe2..0f64fe7e15655c63f996106d504ab4d18dac4a1c 100644
|
|
--- a/net/minecraft/world/entity/monster/zombie/Drowned.java
|
|
+++ b/net/minecraft/world/entity/monster/zombie/Drowned.java
|
|
@@ -116,6 +116,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 1c985585a2da43e59bb5b9ebd742e1e31b2cda29..c3f2d9ab49eb501f26939387624f326227908b81 100644
|
|
--- a/net/minecraft/world/entity/monster/zombie/Husk.java
|
|
+++ b/net/minecraft/world/entity/monster/zombie/Husk.java
|
|
@@ -66,6 +66,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 1fbebd0cd04182679400ef3c33bf0730c01bc645..bf94d8e9512eeb294914c748be091f6565cca676 100644
|
|
--- a/net/minecraft/world/entity/monster/zombie/Zombie.java
|
|
+++ b/net/minecraft/world/entity/monster/zombie/Zombie.java
|
|
@@ -138,6 +138,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
|
|
@@ -550,19 +564,18 @@ public class Zombie extends Monster {
|
|
}
|
|
|
|
if (groupData instanceof Zombie.ZombieGroupData zombieData) {
|
|
- if (zombieData.isBaby) {
|
|
- this.setBaby(true);
|
|
+ if (!jockeyOnlyBaby() || zombieData.isBaby) { // Purpur - Configurable jockey options
|
|
+ this.setBaby(zombieData.isBaby); // Purpur - Configurable jockey options
|
|
if (zombieData.canSpawnJockey) {
|
|
- if (random.nextFloat() < 0.05) {
|
|
- List<Chicken> chickens = level.getEntitiesOfClass(
|
|
+ if (random.nextFloat() < jockeyChance()) { // Purpur - Configurable jockey options
|
|
+ List<Chicken> chickens = 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 (!chickens.isEmpty()) {
|
|
Chicken chicken = chickens.get(0);
|
|
chicken.setChickenJockey(true);
|
|
this.startRiding(chicken, false, false);
|
|
- }
|
|
- } else if (random.nextFloat() < 0.05) {
|
|
+ } else { // Purpur - Configurable jockey options
|
|
Chicken chicken = EntityType.CHICKEN.create(this.level(), EntitySpawnReason.JOCKEY);
|
|
if (chicken != null) {
|
|
chicken.snapTo(this.getX(), this.getY(), this.getZ(), this.getYRot(), 0.0F);
|
|
@@ -571,6 +584,7 @@ public class Zombie extends Monster {
|
|
this.startRiding(chicken, false, false);
|
|
level.addFreshEntity(chicken, 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 02cc4228bfc1ee27ffceb39d6406fce89f6d8312..8a5634d2204b9abae560d34a7b0616b3ebdc68ab 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(final SynchedEntityData.Builder entityData) {
|
|
super.defineSynchedData(entityData);
|
|
diff --git a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
|
|
index b6c14d7c5fbe7f37d4d5b865aae60d4a05af081b..d1edf1f44de1fc6d23bcd8044f8bf4165821790e 100644
|
|
--- a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
|
|
+++ b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java
|
|
@@ -93,6 +93,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));
|