mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 02:17:42 +01: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 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 8c7eb8518a845efb344eba02e9fe804a5dcd5cb5..a80788fc6c537fb0d1f400819c7910d11aeda8d5 100644
|
|
--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
|
+++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java
|
|
@@ -101,6 +101,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));
|