Skip to content

Commit 1505068

Browse files
committed
add happy ghast config options
1 parent bd773d4 commit 1505068

4 files changed

Lines changed: 78 additions & 4 deletions

File tree

purpur-server/minecraft-patches/features/0001-Ridables.patch

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ index 55e74b04ed0576923b8acfdf833e6c999d5a7b6c..900d59620d309258b3b883ccd8cb086f
7575
if ((target instanceof net.minecraft.world.entity.animal.Bucketable && target instanceof LivingEntity && origItem != null && origItem == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelectedItem().isEmpty() || !ServerGamePacketListenerImpl.this.player.getInventory().getSelectedItem().is(origItem))) {
7676
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
7777
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
78-
index efeee8849237270ad7c8cd0577dcefed34b82299..7e9e0e9cd0a12af66d937859885da5c0f619af22 100644
78+
index b2bcdaa27b5b8dcca60da185fa331fcf2d711665..be21e55bb0e3e4ce0a93d20ba5eb80e342c3d29e 100644
7979
--- a/net/minecraft/world/entity/Entity.java
8080
+++ b/net/minecraft/world/entity/Entity.java
8181
@@ -3065,6 +3065,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1076,6 +1076,24 @@ index 354c7a41407fc6518965d09bfe3089676b6da794..a81ada76bfd6c4b49d1552f48e2009bc
10761076
}
10771077
}
10781078
}
1079+
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
1080+
index 8e998a2b35e38dbc74edbaa007f66e98e5486647..3154ba3c1786a607a9f6511288051889632764bf 100644
1081+
--- a/net/minecraft/world/entity/animal/HappyGhast.java
1082+
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
1083+
@@ -120,6 +120,13 @@ public class HappyGhast extends Animal {
1084+
this.removeAllGoals(goal -> true);
1085+
}
1086+
1087+
+ // Purpur start - Ridables
1088+
+ @Override
1089+
+ public boolean dismountsUnderwater() {
1090+
+ return level().purpurConfig.useDismountsUnderwaterTag ? super.dismountsUnderwater() : !level().purpurConfig.happyGhastRidableInWater;
1091+
+ }
1092+
+ // Purpur end - Ridables
1093+
+
1094+
@Override
1095+
protected void ageBoundaryReached() {
1096+
if (this.isBaby()) {
10791097
diff --git a/net/minecraft/world/entity/animal/IronGolem.java b/net/minecraft/world/entity/animal/IronGolem.java
10801098
index 25e0438e1a98dc5f6aaabba8af2295cec871d6f1..d7c330e77c384bba800829bdbe07f6b66695896e 100644
10811099
--- a/net/minecraft/world/entity/animal/IronGolem.java

purpur-server/minecraft-patches/features/0002-Configurable-entity-base-attributes.patch

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,39 @@ index a81ada76bfd6c4b49d1552f48e2009bc7d8c71d2..869a0154c81593db8933f9daa6a7d3a9
201201
@Override
202202
protected void defineSynchedData(SynchedEntityData.Builder builder) {
203203
super.defineSynchedData(builder);
204+
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
205+
index 3154ba3c1786a607a9f6511288051889632764bf..801fc7e1a6ec56a6cde5b787daebe3c8c008cc93 100644
206+
--- a/net/minecraft/world/entity/animal/HappyGhast.java
207+
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
208+
@@ -127,6 +127,19 @@ public class HappyGhast extends Animal {
209+
}
210+
// Purpur end - Ridables
211+
212+
+ // Purpur start - Configurable entity base attributes
213+
+ @Override
214+
+ public void initAttributes() {
215+
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.happyGhastMaxHealth);
216+
+ this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.happyGhastScale);
217+
+ this.getAttribute(Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.happyGhastTemptRange);
218+
+ this.getAttribute(Attributes.FLYING_SPEED).setBaseValue(this.level().purpurConfig.happyGhastFlyingSpeed);
219+
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.happyGhastMovementSpeed);
220+
+ this.getAttribute(Attributes.FOLLOW_RANGE).setBaseValue(this.level().purpurConfig.happyGhastFollowRange);
221+
+ this.getAttribute(Attributes.CAMERA_DISTANCE).setBaseValue(this.level().purpurConfig.happyGhastCameraDistance);
222+
+ }
223+
+ // Purpur end - Configurable entity base attributes
224+
+
225+
@Override
226+
protected void ageBoundaryReached() {
227+
if (this.isBaby()) {
228+
@@ -150,7 +163,7 @@ public class HappyGhast extends Animal {
229+
230+
@Override
231+
protected float sanitizeScale(float scale) {
232+
- return Math.min(scale, 1.0F);
233+
+ return Math.min(scale, 1.0F); // Purpur - Configurable entity base attributes
234+
}
235+
236+
@Override
204237
diff --git a/net/minecraft/world/entity/animal/IronGolem.java b/net/minecraft/world/entity/animal/IronGolem.java
205238
index d7c330e77c384bba800829bdbe07f6b66695896e..1cb7e0985a59e83f118d4656e94a79f4d81836ff 100644
206239
--- a/net/minecraft/world/entity/animal/IronGolem.java

purpur-server/minecraft-patches/features/0012-Make-entity-breeding-times-configurable.patch

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,12 @@ index 869a0154c81593db8933f9daa6a7d3a9d02facc5..37b6bfa8dc1fd4ed0006f6531d2056bc
150150
this.partner.resetLove();
151151
serverLevel.addFreshEntityWithPassengers(fox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
152152
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
153-
index 8e998a2b35e38dbc74edbaa007f66e98e5486647..74bca6719c0bb1a4cabe058eeff6f8dc73632628 100644
153+
index 801fc7e1a6ec56a6cde5b787daebe3c8c008cc93..50a64a312cb6af0f39117993553b66de1f095150 100644
154154
--- a/net/minecraft/world/entity/animal/HappyGhast.java
155155
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
156-
@@ -120,6 +120,13 @@ public class HappyGhast extends Animal {
157-
this.removeAllGoals(goal -> true);
156+
@@ -140,6 +140,13 @@ public class HappyGhast extends Animal {
158157
}
158+
// Purpur end - Configurable entity base attributes
159159

160160
+ // Purpur start - Make entity breeding times configurable
161161
+ @Override

purpur-server/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1972,6 +1972,29 @@ private void halloweenSetting() {
19721972
chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
19731973
}
19741974

1975+
public boolean happyGhastRidableInWater = false;
1976+
public double happyGhastMaxHealth = 20.0D;
1977+
public double happyGhastTemptRange = 16.0D;
1978+
public double happyGhastFlyingSpeed = 0.05D;
1979+
public double happyGhastMovementSpeed = 0.05D;
1980+
public double happyGhastFollowRange = 16.0D;
1981+
public double happyGhastCameraDistance = 8.0D;
1982+
public double happyGhastScale = 1.0D;
1983+
public boolean happyGhastTakeDamageFromWater = false;
1984+
public boolean happyGhastAlwaysDropExp = false;
1985+
private void happyGhastSettings() {
1986+
happyGhastRidableInWater = getBoolean("mobs.happy_ghast.ridable-in-water", happyGhastRidableInWater);
1987+
happyGhastMaxHealth = getDouble("mobs.happy_ghast.attributes.max_health", happyGhastMaxHealth);
1988+
happyGhastTemptRange = getDouble("mobs.happy_ghast.attributes.tempt_range", happyGhastTemptRange);
1989+
happyGhastFlyingSpeed = getDouble("mobs.happy_ghast.attributes.flying_speed", happyGhastFlyingSpeed);
1990+
happyGhastMovementSpeed = getDouble("mobs.happy_ghast.attributes.movement_speed", happyGhastMovementSpeed);
1991+
happyGhastFollowRange = getDouble("mobs.happy_ghast.attributes.follow_range", happyGhastFollowRange);
1992+
happyGhastCameraDistance = getDouble("mobs.happy_ghast.attributes.camera_distance", happyGhastCameraDistance);
1993+
happyGhastScale = Mth.clamp(getDouble("mobs.happy_ghast.attributes.scale", happyGhastScale), 0.0625D, 1.0D);
1994+
happyGhastTakeDamageFromWater = getBoolean("mobs.happy_ghast.takes-damage-from-water", happyGhastTakeDamageFromWater);
1995+
happyGhastAlwaysDropExp = getBoolean("mobs.happy_ghast.always-drop-exp", happyGhastAlwaysDropExp);
1996+
}
1997+
19751998
public boolean hoglinRidable = false;
19761999
public boolean hoglinRidableInWater = true;
19772000
public boolean hoglinControllable = true;

0 commit comments

Comments
 (0)