mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-21 18:37:42 +01:00
Make entities lag less
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
From 38b13b7a3ab0c969150fce2169cb40b9a8255fc1 Mon Sep 17 00:00:00 2001
|
||||
From 5b4eae6813ae81a4973df42286316e660562fbdd 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(-)
|
||||
.../server/BiomeTheEndHighIsland.java | 3 ++-
|
||||
.../net/minecraft/server/EntityPhantom.java | 19 +++++++++++++++++++
|
||||
.../net/minecraft/server/SpawnerCreature.java | 6 ++++++
|
||||
.../java/net/pl3x/purpur/PurpurConfig.java | 5 +++++
|
||||
4 files changed, 32 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..b2a8fe3020 100644
|
||||
@@ -28,10 +28,18 @@ index e8cf6153ec..b2a8fe3020 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
|
||||
index 7496be10a2..836f18a7de 100644
|
||||
index cc175b3970..84038b9c2f 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 {
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -44,11 +52,21 @@ index 7496be10a2..836f18a7de 100644
|
||||
@Override
|
||||
protected EntityAIBodyControl o() {
|
||||
return new EntityPhantom.d(this);
|
||||
@@ -99,6 +105,8 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
||||
@@ -102,6 +109,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);
|
||||
}
|
||||
|
||||
+ 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
|
||||
+ // 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();
|
||||
|
||||
Reference in New Issue
Block a user