add happy ghast config options

This commit is contained in:
granny
2025-06-01 19:34:17 -07:00
parent bd773d449d
commit 1505068927
4 changed files with 78 additions and 4 deletions

View File

@@ -75,7 +75,7 @@ index 55e74b04ed0576923b8acfdf833e6c999d5a7b6c..900d59620d309258b3b883ccd8cb086f
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))) {
target.resendPossiblyDesyncedEntityData(ServerGamePacketListenerImpl.this.player); // Paper - The entire mob gets deleted, so resend it
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index efeee8849237270ad7c8cd0577dcefed34b82299..7e9e0e9cd0a12af66d937859885da5c0f619af22 100644
index b2bcdaa27b5b8dcca60da185fa331fcf2d711665..be21e55bb0e3e4ce0a93d20ba5eb80e342c3d29e 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -3065,6 +3065,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1076,6 +1076,24 @@ index 354c7a41407fc6518965d09bfe3089676b6da794..a81ada76bfd6c4b49d1552f48e2009bc
}
}
}
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
index 8e998a2b35e38dbc74edbaa007f66e98e5486647..3154ba3c1786a607a9f6511288051889632764bf 100644
--- a/net/minecraft/world/entity/animal/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
@@ -120,6 +120,13 @@ public class HappyGhast extends Animal {
this.removeAllGoals(goal -> true);
}
+ // Purpur start - Ridables
+ @Override
+ public boolean dismountsUnderwater() {
+ return level().purpurConfig.useDismountsUnderwaterTag ? super.dismountsUnderwater() : !level().purpurConfig.happyGhastRidableInWater;
+ }
+ // Purpur end - Ridables
+
@Override
protected void ageBoundaryReached() {
if (this.isBaby()) {
diff --git a/net/minecraft/world/entity/animal/IronGolem.java b/net/minecraft/world/entity/animal/IronGolem.java
index 25e0438e1a98dc5f6aaabba8af2295cec871d6f1..d7c330e77c384bba800829bdbe07f6b66695896e 100644
--- a/net/minecraft/world/entity/animal/IronGolem.java

View File

@@ -201,6 +201,39 @@ index a81ada76bfd6c4b49d1552f48e2009bc7d8c71d2..869a0154c81593db8933f9daa6a7d3a9
@Override
protected void defineSynchedData(SynchedEntityData.Builder builder) {
super.defineSynchedData(builder);
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
index 3154ba3c1786a607a9f6511288051889632764bf..801fc7e1a6ec56a6cde5b787daebe3c8c008cc93 100644
--- a/net/minecraft/world/entity/animal/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
@@ -127,6 +127,19 @@ public class HappyGhast extends Animal {
}
// Purpur end - Ridables
+ // Purpur start - Configurable entity base attributes
+ @Override
+ public void initAttributes() {
+ this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.happyGhastMaxHealth);
+ this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.happyGhastScale);
+ this.getAttribute(Attributes.TEMPT_RANGE).setBaseValue(this.level().purpurConfig.happyGhastTemptRange);
+ this.getAttribute(Attributes.FLYING_SPEED).setBaseValue(this.level().purpurConfig.happyGhastFlyingSpeed);
+ this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(this.level().purpurConfig.happyGhastMovementSpeed);
+ this.getAttribute(Attributes.FOLLOW_RANGE).setBaseValue(this.level().purpurConfig.happyGhastFollowRange);
+ this.getAttribute(Attributes.CAMERA_DISTANCE).setBaseValue(this.level().purpurConfig.happyGhastCameraDistance);
+ }
+ // Purpur end - Configurable entity base attributes
+
@Override
protected void ageBoundaryReached() {
if (this.isBaby()) {
@@ -150,7 +163,7 @@ public class HappyGhast extends Animal {
@Override
protected float sanitizeScale(float scale) {
- return Math.min(scale, 1.0F);
+ return Math.min(scale, 1.0F); // Purpur - Configurable entity base attributes
}
@Override
diff --git a/net/minecraft/world/entity/animal/IronGolem.java b/net/minecraft/world/entity/animal/IronGolem.java
index d7c330e77c384bba800829bdbe07f6b66695896e..1cb7e0985a59e83f118d4656e94a79f4d81836ff 100644
--- a/net/minecraft/world/entity/animal/IronGolem.java

View File

@@ -150,12 +150,12 @@ index 869a0154c81593db8933f9daa6a7d3a9d02facc5..37b6bfa8dc1fd4ed0006f6531d2056bc
this.partner.resetLove();
serverLevel.addFreshEntityWithPassengers(fox, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java
index 8e998a2b35e38dbc74edbaa007f66e98e5486647..74bca6719c0bb1a4cabe058eeff6f8dc73632628 100644
index 801fc7e1a6ec56a6cde5b787daebe3c8c008cc93..50a64a312cb6af0f39117993553b66de1f095150 100644
--- a/net/minecraft/world/entity/animal/HappyGhast.java
+++ b/net/minecraft/world/entity/animal/HappyGhast.java
@@ -120,6 +120,13 @@ public class HappyGhast extends Animal {
this.removeAllGoals(goal -> true);
@@ -140,6 +140,13 @@ public class HappyGhast extends Animal {
}
// Purpur end - Configurable entity base attributes
+ // Purpur start - Make entity breeding times configurable
+ @Override

View File

@@ -1972,6 +1972,29 @@ public class PurpurWorldConfig {
chanceHeadHalloweenOnEntity = (float) getDouble("gameplay-mechanics.halloween.head-chance", chanceHeadHalloweenOnEntity);
}
public boolean happyGhastRidableInWater = false;
public double happyGhastMaxHealth = 20.0D;
public double happyGhastTemptRange = 16.0D;
public double happyGhastFlyingSpeed = 0.05D;
public double happyGhastMovementSpeed = 0.05D;
public double happyGhastFollowRange = 16.0D;
public double happyGhastCameraDistance = 8.0D;
public double happyGhastScale = 1.0D;
public boolean happyGhastTakeDamageFromWater = false;
public boolean happyGhastAlwaysDropExp = false;
private void happyGhastSettings() {
happyGhastRidableInWater = getBoolean("mobs.happy_ghast.ridable-in-water", happyGhastRidableInWater);
happyGhastMaxHealth = getDouble("mobs.happy_ghast.attributes.max_health", happyGhastMaxHealth);
happyGhastTemptRange = getDouble("mobs.happy_ghast.attributes.tempt_range", happyGhastTemptRange);
happyGhastFlyingSpeed = getDouble("mobs.happy_ghast.attributes.flying_speed", happyGhastFlyingSpeed);
happyGhastMovementSpeed = getDouble("mobs.happy_ghast.attributes.movement_speed", happyGhastMovementSpeed);
happyGhastFollowRange = getDouble("mobs.happy_ghast.attributes.follow_range", happyGhastFollowRange);
happyGhastCameraDistance = getDouble("mobs.happy_ghast.attributes.camera_distance", happyGhastCameraDistance);
happyGhastScale = Mth.clamp(getDouble("mobs.happy_ghast.attributes.scale", happyGhastScale), 0.0625D, 1.0D);
happyGhastTakeDamageFromWater = getBoolean("mobs.happy_ghast.takes-damage-from-water", happyGhastTakeDamageFromWater);
happyGhastAlwaysDropExp = getBoolean("mobs.happy_ghast.always-drop-exp", happyGhastAlwaysDropExp);
}
public boolean hoglinRidable = false;
public boolean hoglinRidableInWater = true;
public boolean hoglinControllable = true;