-
-
Notifications
You must be signed in to change notification settings - Fork 358
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9b07af9
commit bd24bb5
Showing
2 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
117 changes: 117 additions & 0 deletions
117
patches/server/0032-Phantoms-spawn-naturally-in-the-end.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
From 1bb27847681cd965a4519b727bc43ce2251c3be0 Mon Sep 17 00:00:00 2001 | ||
From: William Blake Galbreath <blake.galbreath@gmail.com> | ||
Date: Thu, 20 Jun 2019 18:48:58 -0500 | ||
Subject: [PATCH] Phantoms spawn naturally in the end | ||
|
||
--- | ||
.../java/net/minecraft/server/BiomeTheEndHighIsland.java | 3 ++- | ||
src/main/java/net/minecraft/server/EntityPhantom.java | 4 +++- | ||
.../java/net/minecraft/server/EntityPositionTypes.java | 3 ++- | ||
src/main/java/net/minecraft/server/SpawnerCreature.java | 7 +++++++ | ||
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++ | ||
5 files changed, 19 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java | ||
index 6592d15291..67cb1520be 100644 | ||
--- a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java | ||
+++ b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java | ||
@@ -4,10 +4,11 @@ public class BiomeTheEndHighIsland extends BiomeBase { | ||
|
||
public BiomeTheEndHighIsland() { | ||
super((new BiomeBase.a()).a(WorldGenSurface.G, WorldGenSurface.F).a(BiomeBase.Precipitation.NONE).a(BiomeBase.Geography.THEEND).a(0.1F).b(0.2F).c(0.5F).d(0.5F).a(4159204).b(329011).a((String) null)); | ||
- this.a(WorldGenerator.END_CITY, (WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e); | ||
+ this.a(WorldGenerator.END_CITY, WorldGenFeatureConfiguration.e); // Purpur - decompile error | ||
this.a(WorldGenStage.Decoration.SURFACE_STRUCTURES, a(WorldGenerator.END_GATEWAY, WorldGenEndGatewayConfiguration.a(WorldProviderTheEnd.f, true), WorldGenDecorator.L, WorldGenFeatureDecoratorConfiguration.e)); | ||
this.a(WorldGenStage.Decoration.SURFACE_STRUCTURES, a(WorldGenerator.END_CITY, WorldGenFeatureConfiguration.e, WorldGenDecorator.h, WorldGenFeatureDecoratorConfiguration.e)); | ||
this.a(WorldGenStage.Decoration.VEGETAL_DECORATION, a(WorldGenerator.CHORUS_PLANT, WorldGenFeatureConfiguration.e, WorldGenDecorator.K, WorldGenFeatureDecoratorConfiguration.e)); | ||
this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.ENDERMAN, 10, 4, 4)); | ||
+ if (net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd) this.a(EnumCreatureType.MONSTER, new BiomeBase.BiomeMeta(EntityTypes.PHANTOM, 5, 1, 4)); // Purpur | ||
} | ||
} | ||
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java | ||
index 238c68edf5..9b03334db2 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityPhantom.java | ||
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java | ||
@@ -10,7 +10,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { | ||
|
||
private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityPhantom.class, DataWatcherRegistry.b); | ||
private Vec3D c; | ||
- private BlockPosition d; | ||
+ private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER | ||
private EntityPhantom.AttackPhase bz; | ||
private BlockPosition crystalPosition; // Purpur | ||
|
||
@@ -100,6 +100,8 @@ public class EntityPhantom extends EntityFlying implements IMonster { | ||
this.world.addParticle(Particles.MYCELIUM, this.locX - (double) f2, this.locY + (double) f4, this.locZ - (double) f3, 0.0D, 0.0D, 0.0D); | ||
} | ||
|
||
+ if (net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd && world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END && getHome().y < 70) getHome().y = 70 + world.random.nextInt(20); // Purpur | ||
+ | ||
if (!this.world.isClientSide && this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { | ||
this.die(); | ||
} | ||
diff --git a/src/main/java/net/minecraft/server/EntityPositionTypes.java b/src/main/java/net/minecraft/server/EntityPositionTypes.java | ||
index c867b80b6c..a6b9e0e79a 100644 | ||
--- a/src/main/java/net/minecraft/server/EntityPositionTypes.java | ||
+++ b/src/main/java/net/minecraft/server/EntityPositionTypes.java | ||
@@ -55,6 +55,7 @@ public class EntityPositionTypes { | ||
a(EntityTypes.MULE, EntityPositionTypes.Surface.ON_GROUND, HeightMap.Type.MOTION_BLOCKING_NO_LEAVES); | ||
a(EntityTypes.OCELOT, EntityPositionTypes.Surface.ON_GROUND, HeightMap.Type.MOTION_BLOCKING); | ||
a(EntityTypes.PARROT, EntityPositionTypes.Surface.ON_GROUND, HeightMap.Type.MOTION_BLOCKING); | ||
+ a(EntityTypes.PHANTOM, EntityPositionTypes.Surface.IN_AIR, HeightMap.Type.MOTION_BLOCKING_NO_LEAVES); // Purpur | ||
a(EntityTypes.PIG, EntityPositionTypes.Surface.ON_GROUND, HeightMap.Type.MOTION_BLOCKING_NO_LEAVES); | ||
a(EntityTypes.PILLAGER, EntityPositionTypes.Surface.ON_GROUND, HeightMap.Type.MOTION_BLOCKING_NO_LEAVES); | ||
a(EntityTypes.POLAR_BEAR, EntityPositionTypes.Surface.ON_GROUND, HeightMap.Type.MOTION_BLOCKING_NO_LEAVES); | ||
@@ -81,7 +82,7 @@ public class EntityPositionTypes { | ||
|
||
public static enum Surface { | ||
|
||
- ON_GROUND, IN_WATER; | ||
+ ON_GROUND, IN_WATER, IN_AIR; // Purpur | ||
|
||
private Surface() {} | ||
} | ||
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java | ||
index d7e1ed073d..7fd14b807f 100644 | ||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java | ||
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java | ||
@@ -75,6 +75,12 @@ public final class SpawnerCreature { | ||
if (biomebase_biomemeta.b.d() != EnumCreatureType.MISC) { | ||
EntityTypes<?> entitytypes = biomebase_biomemeta.b; | ||
|
||
+ // Purpur start | ||
+ if (net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd && entitytypes == EntityTypes.PHANTOM) { | ||
+ blockposition_mutableblockposition.y = 70 + world.random.nextInt(20); | ||
+ } | ||
+ // Purpur end | ||
+ | ||
if (entitytypes.b() && a(chunkgenerator, enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { | ||
EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(entitytypes); | ||
|
||
@@ -196,6 +202,7 @@ public final class SpawnerCreature { | ||
switch (entitypositiontypes_surface) { | ||
case IN_WATER: | ||
return fluid.a(TagsFluid.WATER) && iworldreader.getFluid(blockposition2).a(TagsFluid.WATER) && !iworldreader.getType(blockposition1).isOccluding(iworldreader, blockposition1); | ||
+ case IN_AIR: return iworldreader.getType(blockposition2).getBlock() == Blocks.AIR; // Purpur | ||
case ON_GROUND: | ||
default: | ||
IBlockData iblockdata1 = iworldreader.getType(blockposition2); | ||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java | ||
index 9764221e82..a3cf1130e7 100644 | ||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java | ||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java | ||
@@ -132,6 +132,11 @@ public class PurpurConfig { | ||
ironGolemSwims = getBoolean("settings.mobs.iron_golem.swims", ironGolemSwims); | ||
} | ||
|
||
+ public static boolean spawnPhantomsInTheEnd = true; | ||
+ private static void phantomSettings() { | ||
+ spawnPhantomsInTheEnd = getBoolean("settings.mobs.phantom.spawn-in-the-end", spawnPhantomsInTheEnd); | ||
+ } | ||
+ | ||
public static boolean snowmanDropsPumpkin = true; | ||
public static boolean snowmanPumpkinPutBack = true; | ||
private static void snowmansSettings() { | ||
-- | ||
2.20.1 | ||
|