mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-20 01:47:42 +01:00
92 lines
5.7 KiB
Diff
92 lines
5.7 KiB
Diff
From 1d912562ca7ded8150831918d533b2b0d83878cd 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 | 8 ++++++++
|
|
src/main/java/net/minecraft/server/SpawnerCreature.java | 6 ++++++
|
|
src/main/java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
|
4 files changed, 21 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java
|
|
index 6592d1529..67cb1520b 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 008f5c6fa..149c64b44 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
@@ -25,6 +25,12 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
this.canBeRiddenInWater = false; // Purpur
|
|
}
|
|
|
|
+ // Purpur start
|
|
+ public static boolean canSpawn(EntityTypes<? extends EntityPhantom> entitytypes, GeneratorAccess world, EnumMobSpawn enummobspawn, BlockPosition position, java.util.Random random) {
|
|
+ return world.getDifficulty() != EnumDifficulty.PEACEFUL && a(entitytypes, world, enummobspawn, position, random);
|
|
+ }
|
|
+ // Purpur end
|
|
+
|
|
@Override
|
|
protected EntityAIBodyControl o() {
|
|
return new EntityPhantom.d(this);
|
|
@@ -99,6 +105,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/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
|
index b442e09eb..3e16cb2bc 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);
|
|
|
|
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
index ad373d20c..233805175 100644
|
|
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
|
@@ -160,6 +160,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
|
|
|