Files
Purpur/patches/server/0229-Configurable-phantom-size.patch
granny ffeb49da1e ignore item_model component for don't run with scissors feature alongside custom_model_data component
by default, the "don't run with scissors" feature will not activate for shears that have an `item_model` component or `custom_model_data` component.

adds a new world config option at `gameplay-mechanics.item.shears.damage-if-sprinting-item-model` that allows specifying a custom item model ResourceLocation (`purpurmc:scissors` by default) for use with this feature.
2024-12-06 06:05:14 -08:00

51 lines
2.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@Gmail.com>
Date: Mon, 17 Jan 2022 21:28:49 -0600
Subject: [PATCH] Configurable phantom size
diff --git a/src/main/java/net/minecraft/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
index 3104b76d98a2b3870535ea5e776fb8fb6e5d3680..23ca324c5379f9735232a9f74071117da23c2290 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
@@ -261,7 +261,11 @@ public class Phantom extends FlyingMob implements Enemy {
@Override
public SpawnGroupData finalizeSpawn(ServerLevelAccessor world, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData entityData) {
this.anchorPoint = this.blockPosition().above(5);
- this.setPhantomSize(0);
+ // Purpur start
+ int min = world.getLevel().purpurConfig.phantomMinSize;
+ int max = world.getLevel().purpurConfig.phantomMaxSize;
+ this.setPhantomSize(min == max ? min : world.getRandom().nextInt(max + 1 - min) + min);
+ // Purpur end
return super.finalizeSpawn(world, difficulty, spawnReason, entityData);
}
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 79df9922bf8f0fc9a74b1ef97e59ff47e749cd7b..aa8ea52c7e9a4c60864328a30a86530e73385563 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -2176,6 +2176,8 @@ public class PurpurWorldConfig {
public boolean phantomFlamesOnSwoop = false;
public boolean phantomTakeDamageFromWater = false;
public boolean phantomAlwaysDropExp = false;
+ public int phantomMinSize = 0;
+ public int phantomMaxSize = 0;
private void phantomSettings() {
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
@@ -2212,6 +2214,13 @@ public class PurpurWorldConfig {
phantomFlamesOnSwoop = getBoolean("mobs.phantom.flames-on-swoop", phantomFlamesOnSwoop);
phantomTakeDamageFromWater = getBoolean("mobs.phantom.takes-damage-from-water", phantomTakeDamageFromWater);
phantomAlwaysDropExp = getBoolean("mobs.phantom.always-drop-exp", phantomAlwaysDropExp);
+ phantomMinSize = Mth.clamp(getInt("mobs.phantom.size.min", phantomMinSize), 0, 64);
+ phantomMaxSize = Mth.clamp(getInt("mobs.phantom.size.max", phantomMaxSize), 0, 64);
+ if (phantomMinSize > phantomMaxSize) {
+ phantomMinSize = phantomMinSize ^ phantomMaxSize;
+ phantomMaxSize = phantomMinSize ^ phantomMaxSize;
+ phantomMinSize = phantomMinSize ^ phantomMaxSize;
+ }
}
public boolean pigRidable = false;