2015-06-04 08:42:09 +00:00
|
|
|
From 8a9a9c387f3eef8338ed3d8e9d89dfc0b10a7349 Mon Sep 17 00:00:00 2001
|
2015-05-29 03:19:49 +00:00
|
|
|
From: Zach Brown <zach.brown@destroystokyo.com>
|
|
|
|
Date: Thu, 28 May 2015 22:01:25 -0500
|
|
|
|
Subject: [PATCH] Force load chunks for specific entities that fly through
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
|
|
|
|
index f4b5032..a7190fa 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
|
|
|
|
@@ -86,8 +86,20 @@ public class EntityEnderPearl extends EntityProjectile {
|
|
|
|
}
|
|
|
|
|
|
|
|
public void t_() {
|
|
|
|
- EntityLiving entityliving = this.getShooter();
|
|
|
|
+ // PaperSpigot start - Force load chunks for specific entities that fly through
|
|
|
|
+ if (world.paperSpigotConfig.loadUnloadedEnderPearls) {
|
|
|
|
+ ChunkProviderServer chunkProvider = (ChunkProviderServer) world.chunkProvider;
|
|
|
|
+ boolean before = chunkProvider.forceChunkLoad;
|
|
|
|
+ chunkProvider.forceChunkLoad = true;
|
|
|
|
+ for (int cx = (int) locX >> 4; cx <= (int) (locX + motX) >> 4; ++cx) {
|
|
|
|
+ for (int cz = (int) locZ >> 4; cz <= (int) (locZ + motZ) >> 4; ++cz) {
|
|
|
|
+ world.getChunkAt(cx, cz);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ chunkProvider.forceChunkLoad = before;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ EntityLiving entityliving = this.getShooter();
|
|
|
|
if (entityliving != null && entityliving instanceof EntityHuman && !entityliving.isAlive()) {
|
|
|
|
this.die();
|
|
|
|
} else {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
index 44219cd..a0452ac 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
|
|
|
|
@@ -60,6 +60,21 @@ public class EntityFallingBlock extends Entity {
|
|
|
|
if (block.getMaterial() == Material.AIR) {
|
|
|
|
this.die();
|
|
|
|
} else {
|
|
|
|
+ // PaperSpigot start - Force load chunks for specific entities that fly through
|
|
|
|
+ if (world.paperSpigotConfig.loadUnloadedFallingBlocks) {
|
|
|
|
+ ChunkProviderServer chunkProvider = (ChunkProviderServer) world.chunkProvider;
|
|
|
|
+ boolean before = chunkProvider.forceChunkLoad;
|
|
|
|
+ chunkProvider.forceChunkLoad = true;
|
|
|
|
+
|
|
|
|
+ for (int cx = (int) locX >> 4; cx <= (int) (locX + motX) >> 4; ++cx) {
|
|
|
|
+ for (int cz = (int) locZ >> 4; cz <= (int) (locZ + motZ) >> 4; ++cz) {
|
|
|
|
+ world.getChunkAt(cx, cz);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ chunkProvider.forceChunkLoad = before;
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
this.lastX = this.locX;
|
|
|
|
this.lastY = this.locY;
|
|
|
|
this.lastZ = this.locZ;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2015-06-04 08:42:09 +00:00
|
|
|
index 1daba4e..db33c98 100644
|
2015-05-29 03:19:49 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
2015-06-04 08:42:09 +00:00
|
|
|
@@ -50,6 +50,21 @@ public class EntityTNTPrimed extends Entity {
|
2015-05-29 03:19:49 +00:00
|
|
|
|
|
|
|
public void t_() {
|
|
|
|
if (world.spigotConfig.currentPrimedTnt++ > world.spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
|
|
|
+ // PaperSpigot start - Force load chunks for specific entities that fly through
|
|
|
|
+ if (world.paperSpigotConfig.loadUnloadedTNTEntities) {
|
|
|
|
+ ChunkProviderServer chunkProvider = (ChunkProviderServer) world.chunkProvider;
|
|
|
|
+ boolean before = chunkProvider.forceChunkLoad;
|
|
|
|
+ chunkProvider.forceChunkLoad = true;
|
|
|
|
+
|
|
|
|
+ for (int cx = (int) locX >> 4; cx <= (int) (locX + motX) >> 4; ++cx) {
|
|
|
|
+ for (int cz = (int) locZ >> 4; cz <= (int) (locZ + motZ) >> 4; ++cz) {
|
|
|
|
+ world.getChunkAt(cx, cz);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ chunkProvider.forceChunkLoad = before;
|
|
|
|
+ }
|
|
|
|
+ // PaperSpigot end
|
|
|
|
this.lastX = this.locX;
|
|
|
|
this.lastY = this.locY;
|
|
|
|
this.lastZ = this.locZ;
|
2015-06-04 08:42:09 +00:00
|
|
|
@@ -97,7 +112,19 @@ public class EntityTNTPrimed extends Entity {
|
|
|
|
server.getPluginManager().callEvent(event);
|
2015-05-29 03:19:49 +00:00
|
|
|
|
2015-06-04 08:42:09 +00:00
|
|
|
if (!event.isCancelled()) {
|
|
|
|
- this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
2015-05-29 03:19:49 +00:00
|
|
|
+ // PaperSpigot start - Force load chunks for specific entities that fly through
|
|
|
|
+ if (world.paperSpigotConfig.loadUnloadedTNTEntities) {
|
|
|
|
+ ChunkProviderServer chunkProvider = (ChunkProviderServer) world.chunkProvider;
|
|
|
|
+ boolean before = chunkProvider.forceChunkLoad;
|
|
|
|
+ chunkProvider.forceChunkLoad = true;
|
|
|
|
+
|
2015-06-04 08:42:09 +00:00
|
|
|
+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
2015-05-29 03:19:49 +00:00
|
|
|
+
|
|
|
|
+ chunkProvider.forceChunkLoad = before;
|
|
|
|
+ } else {
|
2015-06-04 08:42:09 +00:00
|
|
|
+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
2015-05-29 03:19:49 +00:00
|
|
|
+ }
|
2015-06-04 08:42:09 +00:00
|
|
|
+ // PaperSpigot end
|
2015-05-29 03:19:49 +00:00
|
|
|
}
|
|
|
|
// CraftBukkit end
|
2015-06-04 08:42:09 +00:00
|
|
|
}
|
2015-05-29 03:19:49 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
2015-05-30 06:39:20 +00:00
|
|
|
index 86913f4..385d742 100644
|
2015-05-29 03:19:49 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2015-05-30 06:39:20 +00:00
|
|
|
@@ -1641,6 +1641,17 @@ public abstract class World implements IBlockAccess {
|
2015-05-29 03:19:49 +00:00
|
|
|
if (this.isChunkLoaded(k, i1, true)) {
|
|
|
|
entity.ad = true;
|
|
|
|
this.getChunkAt(k, i1).a(entity);
|
|
|
|
+ // PaperSpigot start - Force load chunks for specific entities that fly through
|
|
|
|
+ } else if ((entity instanceof EntityEnderPearl && entity.world.paperSpigotConfig.loadUnloadedEnderPearls) ||
|
|
|
|
+ (entity instanceof EntityTNTPrimed && entity.world.paperSpigotConfig.loadUnloadedTNTEntities) ||
|
|
|
|
+ (entity instanceof EntityFallingBlock && entity.world.paperSpigotConfig.loadUnloadedFallingBlocks)) {
|
|
|
|
+ ChunkProviderServer chunkProvider = (ChunkProviderServer) this.chunkProvider;
|
|
|
|
+ boolean before = chunkProvider.forceChunkLoad;
|
|
|
|
+ chunkProvider.forceChunkLoad = true;
|
|
|
|
+ entity.ad = true;
|
|
|
|
+ this.getChunkAt(k, i1).a(entity);
|
|
|
|
+ chunkProvider.forceChunkLoad = before;
|
|
|
|
+ // PaperSpigot end
|
|
|
|
} else {
|
|
|
|
entity.ad = false;
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
2015-06-04 08:42:09 +00:00
|
|
|
index 4d16fa7..fd2174a 100644
|
2015-05-29 03:19:49 +00:00
|
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
2015-06-04 08:42:09 +00:00
|
|
|
@@ -223,4 +223,14 @@ public class PaperSpigotWorldConfig
|
2015-05-29 03:19:49 +00:00
|
|
|
{
|
|
|
|
disableEndCredits = getBoolean( "game-mechanics.disable-end-credits", false );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public boolean loadUnloadedEnderPearls;
|
|
|
|
+ public boolean loadUnloadedTNTEntities;
|
|
|
|
+ public boolean loadUnloadedFallingBlocks;
|
|
|
|
+ private void loadUnloaded()
|
|
|
|
+ {
|
|
|
|
+ loadUnloadedEnderPearls = getBoolean( "load-chunks.enderpearls", false );
|
|
|
|
+ loadUnloadedTNTEntities = getBoolean( "load-chunks.tnt-entities", false );
|
|
|
|
+ loadUnloadedFallingBlocks = getBoolean( "load-chunks.falling-blocks", false );
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
index 7ca1b24..dcab40c 100644
|
|
|
|
--- a/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/ActivationRange.java
|
|
|
|
@@ -13,6 +13,7 @@ import net.minecraft.server.EntityComplexPart;
|
|
|
|
import net.minecraft.server.EntityCreature;
|
|
|
|
import net.minecraft.server.EntityEnderCrystal;
|
|
|
|
import net.minecraft.server.EntityEnderDragon;
|
|
|
|
+import net.minecraft.server.EntityEnderPearl; // PaperSpigot
|
|
|
|
import net.minecraft.server.EntityFallingBlock;
|
|
|
|
import net.minecraft.server.EntityFireball;
|
|
|
|
import net.minecraft.server.EntityFireworks;
|
|
|
|
@@ -247,7 +248,10 @@ public class ActivationRange
|
|
|
|
{
|
|
|
|
SpigotTimings.checkIfActiveTimer.startTiming();
|
|
|
|
// Never safe to skip fireworks or entities not yet added to chunk
|
|
|
|
- if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks ) {
|
|
|
|
+ // PaperSpigot - Changes for loading chunks for entities that fly through them
|
|
|
|
+ if ( !entity.isAddedToChunk() || entity instanceof EntityFireworks || entity instanceof EntityFallingBlock ||
|
|
|
|
+ ( entity instanceof EntityEnderPearl && entity.world.paperSpigotConfig.loadUnloadedEnderPearls ) ||
|
|
|
|
+ ( entity instanceof EntityTNTPrimed && entity.world.paperSpigotConfig.loadUnloadedTNTEntities ) ) {
|
|
|
|
SpigotTimings.checkIfActiveTimer.stopTiming();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
--
|
2015-06-04 08:42:09 +00:00
|
|
|
1.9.5.msysgit.1
|
2015-05-29 03:19:49 +00:00
|
|
|
|