2015-05-30 08:39:20 +02:00
|
|
|
From 7b735d8eaea7f21c2c18525ae2f603b729ac19ad Mon Sep 17 00:00:00 2001
|
2014-08-30 03:38:35 +02:00
|
|
|
From: Iceee <andrew@opticgaming.tv>
|
2015-03-08 02:16:09 +01:00
|
|
|
Date: Sun, 8 Mar 2015 03:34:15 -0500
|
|
|
|
Subject: [PATCH] Remove certain entities that fly through unloaded chunks
|
2014-08-30 03:38:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
2015-03-08 02:16:09 +01:00
|
|
|
index d6bef0b..1470c21 100644
|
2014-08-30 03:38:35 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2015-03-08 02:16:09 +01:00
|
|
|
@@ -114,6 +114,7 @@ public abstract class Entity implements ICommandListener {
|
|
|
|
private final CommandObjectiveExecutor au;
|
2014-08-30 03:38:35 +02:00
|
|
|
public boolean valid; // CraftBukkit
|
|
|
|
public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only
|
|
|
|
+ public boolean inUnloadedChunk = false; // PaperSpigot - Remove entities in unloaded chunks
|
|
|
|
|
|
|
|
// Spigot start
|
|
|
|
public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
|
2015-05-30 08:39:20 +02:00
|
|
|
index 48ada4d..f4b5032 100644
|
2014-08-30 03:38:35 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
|
2015-03-08 02:16:09 +01:00
|
|
|
@@ -30,6 +30,12 @@ public class EntityEnderPearl extends EntityProjectile {
|
2014-11-28 02:17:45 +01:00
|
|
|
movingobjectposition.entity.damageEntity(DamageSource.projectile(this, entityliving), 0.0F);
|
2014-08-30 03:38:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ // PaperSpigot start - Remove entities in unloaded chunks
|
2015-03-08 02:16:09 +01:00
|
|
|
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedEnderPearls) {
|
|
|
|
+ this.die();
|
2014-08-30 03:38:35 +02:00
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
+
|
|
|
|
for (int i = 0; i < 32; ++i) {
|
2014-11-28 02:17:45 +01:00
|
|
|
this.world.addParticle(EnumParticle.PORTAL, this.locX, this.locY + this.random.nextDouble() * 2.0D, this.locZ, this.random.nextGaussian(), 0.0D, this.random.nextGaussian(), new int[0]);
|
2014-08-30 03:38:35 +02:00
|
|
|
}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2015-03-08 02:16:09 +01:00
|
|
|
index ef93776..5931e1d 100644
|
2014-08-30 03:38:35 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
2014-11-28 02:17:45 +01:00
|
|
|
@@ -70,6 +70,12 @@ public class EntityFallingBlock extends Entity {
|
2014-08-30 03:38:35 +02:00
|
|
|
this.motY -= 0.03999999910593033D;
|
|
|
|
this.move(this.motX, this.motY, this.motZ);
|
2014-11-28 02:17:45 +01:00
|
|
|
|
2014-08-30 03:38:35 +02:00
|
|
|
+ // PaperSpigot start - Remove entities in unloaded chunks
|
|
|
|
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedFallingBlocks) {
|
|
|
|
+ this.die();
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
2014-11-28 02:17:45 +01:00
|
|
|
+
|
2014-08-30 03:38:35 +02:00
|
|
|
// PaperSpigot start - Drop falling blocks above the specified height
|
|
|
|
if (this.world.paperSpigotConfig.fallingBlockHeightNerf != 0 && this.locY > this.world.paperSpigotConfig.fallingBlockHeightNerf) {
|
2014-11-28 02:17:45 +01:00
|
|
|
if (this.dropItem) {
|
2014-08-30 03:38:35 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2015-03-08 02:16:09 +01:00
|
|
|
index 2d22327..50423eb 100644
|
2014-08-30 03:38:35 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2014-11-28 02:17:45 +01:00
|
|
|
@@ -47,6 +47,14 @@ public class EntityTNTPrimed extends Entity {
|
2014-08-30 03:38:35 +02:00
|
|
|
this.lastZ = this.locZ;
|
|
|
|
this.motY -= 0.03999999910593033D;
|
|
|
|
this.move(this.motX, this.motY, this.motZ);
|
2014-11-28 02:17:45 +01:00
|
|
|
+
|
2014-08-30 03:38:35 +02:00
|
|
|
+ // PaperSpigot start - Remove entities in unloaded chunks
|
|
|
|
+ if (this.inUnloadedChunk && world.paperSpigotConfig.removeUnloadedTNTEntities) {
|
|
|
|
+ this.die();
|
|
|
|
+ this.fuseTicks = 2;
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
2014-11-28 02:17:45 +01:00
|
|
|
+
|
2014-08-30 03:38:35 +02:00
|
|
|
this.motX *= 0.9800000190734863D;
|
|
|
|
this.motY *= 0.9800000190734863D;
|
|
|
|
this.motZ *= 0.9800000190734863D;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2015-05-30 08:39:20 +02:00
|
|
|
index 67c739e..530e60f 100644
|
2014-08-30 03:38:35 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2015-05-30 08:39:20 +02:00
|
|
|
@@ -1156,6 +1156,7 @@ public abstract class World implements IBlockAccess {
|
2014-08-30 03:38:35 +02:00
|
|
|
{
|
2014-11-28 02:17:45 +01:00
|
|
|
if ( !this.isChunkLoaded( chunkx, chunkz, true ) )
|
2014-08-30 03:38:35 +02:00
|
|
|
{
|
|
|
|
+ entity.inUnloadedChunk = true; // PaperSpigot - Remove entities in unloaded chunks
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
int cz = chunkz << 4;
|
2015-05-30 08:39:20 +02:00
|
|
|
@@ -1567,6 +1568,14 @@ public abstract class World implements IBlockAccess {
|
2014-08-30 03:38:35 +02:00
|
|
|
if (!org.spigotmc.ActivationRange.checkIfActive(entity)) {
|
|
|
|
entity.ticksLived++;
|
|
|
|
entity.inactiveTick();
|
|
|
|
+ // PaperSpigot start - Remove entities in unloaded chunks
|
2015-04-17 12:25:02 +02:00
|
|
|
+ if (!this.isChunkLoaded(i, j, true) && ((entity instanceof EntityEnderPearl && this.paperSpigotConfig.removeUnloadedEnderPearls) ||
|
2014-10-15 02:36:06 +02:00
|
|
|
+ (entity instanceof EntityFallingBlock && this.paperSpigotConfig.removeUnloadedFallingBlocks) ||
|
|
|
|
+ (entity instanceof EntityTNTPrimed && this.paperSpigotConfig.removeUnloadedTNTEntities))) {
|
2015-03-08 02:16:09 +01:00
|
|
|
+ entity.inUnloadedChunk = true;
|
2014-08-30 03:38:35 +02:00
|
|
|
+ entity.die();
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
} else {
|
|
|
|
entity.tickTimer.startTiming(); // Spigot
|
|
|
|
// CraftBukkit end
|
|
|
|
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
2015-03-08 02:16:09 +01:00
|
|
|
index 31dedce..ac02b90 100644
|
2014-08-30 03:38:35 +02:00
|
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
2015-03-08 02:16:09 +01:00
|
|
|
@@ -170,4 +170,14 @@ public class PaperSpigotWorldConfig
|
2014-10-25 06:41:49 +02:00
|
|
|
removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true );
|
2014-08-30 03:38:35 +02:00
|
|
|
log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean removeUnloadedEnderPearls;
|
|
|
|
+ public boolean removeUnloadedTNTEntities;
|
|
|
|
+ public boolean removeUnloadedFallingBlocks;
|
|
|
|
+ private void removeUnloaded()
|
|
|
|
+ {
|
2014-10-25 05:28:29 +02:00
|
|
|
+ removeUnloadedEnderPearls = getBoolean( "remove-unloaded.enderpearls", true );
|
|
|
|
+ removeUnloadedTNTEntities = getBoolean( "remove-unloaded.tnt-entities", true );
|
|
|
|
+ removeUnloadedFallingBlocks = getBoolean( "remove-unloaded.falling-blocks", true );
|
2014-08-30 03:38:35 +02:00
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
2015-05-19 01:41:57 +02:00
|
|
|
2.4.1.windows.1
|
2014-08-30 03:38:35 +02:00
|
|
|
|