Skip to content
This repository was archived by the owner on Apr 13, 2025. It is now read-only.

Commit eb5eda7

Browse files
BillyGalbreathgranny
authored andcommitted
Configurable phantom size
1 parent b3d0394 commit eb5eda7

3 files changed

Lines changed: 24 additions & 50 deletions

File tree

patches/server/0227-Configurable-phantom-size.patch

Lines changed: 0 additions & 50 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--- a/net/minecraft/world/entity/monster/Phantom.java
2+
+++ b/net/minecraft/world/entity/monster/Phantom.java
3+
@@ -158,7 +_,11 @@
4+
ServerLevelAccessor level, DifficultyInstance difficulty, EntitySpawnReason spawnReason, @Nullable SpawnGroupData spawnGroupData
5+
) {
6+
this.anchorPoint = this.blockPosition().above(5);
7+
- this.setPhantomSize(0);
8+
+ // Purpur start - Configurable phantom size
9+
+ int min = level.getLevel().purpurConfig.phantomMinSize;
10+
+ int max = level.getLevel().purpurConfig.phantomMaxSize;
11+
+ this.setPhantomSize(min == max ? min : level.getRandom().nextInt(max + 1 - min) + min);
12+
+ // Purpur end - Configurable phantom size
13+
return super.finalizeSpawn(level, difficulty, spawnReason, spawnGroupData);
14+
}
15+

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,6 +2182,8 @@ private void parrotSettings() {
21822182
public boolean phantomFlamesOnSwoop = false;
21832183
public boolean phantomTakeDamageFromWater = false;
21842184
public boolean phantomAlwaysDropExp = false;
2185+
public int phantomMinSize = 0;
2186+
public int phantomMaxSize = 0;
21852187
private void phantomSettings() {
21862188
phantomRidable = getBoolean("mobs.phantom.ridable", phantomRidable);
21872189
phantomRidableInWater = getBoolean("mobs.phantom.ridable-in-water", phantomRidableInWater);
@@ -2218,6 +2220,13 @@ private void phantomSettings() {
22182220
phantomFlamesOnSwoop = getBoolean("mobs.phantom.flames-on-swoop", phantomFlamesOnSwoop);
22192221
phantomTakeDamageFromWater = getBoolean("mobs.phantom.takes-damage-from-water", phantomTakeDamageFromWater);
22202222
phantomAlwaysDropExp = getBoolean("mobs.phantom.always-drop-exp", phantomAlwaysDropExp);
2223+
phantomMinSize = Mth.clamp(getInt("mobs.phantom.size.min", phantomMinSize), 0, 64);
2224+
phantomMaxSize = Mth.clamp(getInt("mobs.phantom.size.max", phantomMaxSize), 0, 64);
2225+
if (phantomMinSize > phantomMaxSize) {
2226+
phantomMinSize = phantomMinSize ^ phantomMaxSize;
2227+
phantomMaxSize = phantomMinSize ^ phantomMaxSize;
2228+
phantomMinSize = phantomMinSize ^ phantomMaxSize;
2229+
}
22212230
}
22222231

22232232
public boolean pigRidable = false;

0 commit comments

Comments
 (0)