mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Remove some patches and fix natural spawn issues
This commit is contained in:
109
patches/server/0030-Phantoms-spawn-naturally-in-the-end.patch
Normal file
109
patches/server/0030-Phantoms-spawn-naturally-in-the-end.patch
Normal file
@@ -0,0 +1,109 @@
|
||||
From 846ad89741fbfde6234139c5d4fbe0df91006d71 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
|
||||
|
||||
---
|
||||
.../server/BiomeTheEndHighIsland.java | 3 ++-
|
||||
.../net/minecraft/server/EntityPhantom.java | 19 +++++++++++++++++++
|
||||
.../net/minecraft/server/SpawnerCreature.java | 5 +++++
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 2 ++
|
||||
4 files changed, 28 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java b/src/main/java/net/minecraft/server/BiomeTheEndHighIsland.java
|
||||
index e8cf6153ec..82f3a9a95f 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));
|
||||
BiomeDecoratorGroups.aq(this);
|
||||
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));
|
||||
+ 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 69a1c79e74..2fada230bc 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
@@ -12,6 +12,7 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
private BlockPosition d; public void setHome(BlockPosition home) { this.d = home; } public BlockPosition getHome() { return this.d; } // Purpur - OBFHELPER
|
||||
private EntityPhantom.AttackPhase bz; public AttackPhase getAttackPhase() { return this.bz; } // Purpur - OBFHELPER
|
||||
private BlockPosition crystalPosition; // Purpur
|
||||
+ private boolean firstTick = true; // Purpur
|
||||
|
||||
public EntityPhantom(EntityTypes<? extends EntityPhantom> entitytypes, World world) {
|
||||
super(entitytypes, world);
|
||||
@@ -25,6 +26,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);
|
||||
@@ -105,6 +112,18 @@ 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);
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ if (firstTick) {
|
||||
+ firstTick = false;
|
||||
+ if (net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd) {
|
||||
+ if (world.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END && getHome().y < 70) {
|
||||
+ // correct home position if spawned in the end
|
||||
+ getHome().y = 70 + world.random.nextInt(20);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
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 2d4ea99f16..ad4341cba5 100644
|
||||
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
|
||||
@@ -83,6 +83,11 @@ public final class SpawnerCreature {
|
||||
if (!net.pl3x.purpur.PurpurConfig.giantsNaturallySpawn) {
|
||||
return amountSpawned;
|
||||
}
|
||||
+ } else if (entitytypes == EntityTypes.PHANTOM) {
|
||||
+ if (!net.pl3x.purpur.PurpurConfig.spawnPhantomsInTheEnd) {
|
||||
+ return amountSpawned;
|
||||
+ }
|
||||
+ blockposition_mutableblockposition.y = 70 + world.random.nextInt(20);
|
||||
}
|
||||
// Purpur end
|
||||
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurConfig.java b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
index cd9805e5fb..e86864a5ea 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurConfig.java
|
||||
@@ -157,10 +157,12 @@ public class PurpurConfig {
|
||||
public static double crystalsAttackPhantomsRadius = 0.0D;
|
||||
public static float crystalsAttackPhantomDamage = 1.0F;
|
||||
public static double phantomsOrbitCrystalsRadius = 0.0D;
|
||||
+ public static boolean spawnPhantomsInTheEnd = false;
|
||||
private static void phantomSettings() {
|
||||
crystalsAttackPhantomsRadius = getDouble("settings.mobs.phantom.crystals-attack-range", crystalsAttackPhantomsRadius);
|
||||
crystalsAttackPhantomDamage = (float) getDouble("settings.mobs.phantom.crystals-attack-damage", crystalsAttackPhantomDamage);
|
||||
phantomsOrbitCrystalsRadius = getDouble("settings.mob.phantom.orbit-crystal-radius", phantomsOrbitCrystalsRadius);
|
||||
+ spawnPhantomsInTheEnd = getBoolean("settings.mobs.phantom.spawn-in-the-end", spawnPhantomsInTheEnd);
|
||||
}
|
||||
|
||||
public static boolean snowmanDropsPumpkin = false;
|
||||
--
|
||||
2.20.1
|
||||
|
||||
Reference in New Issue
Block a user