geforkt von Mirrors/Paper
6b6eb8f7f7
Removes ArmorStand Marker API as that was added to Bukkit
174 Zeilen
9.0 KiB
Diff
174 Zeilen
9.0 KiB
Diff
From b9323137c152e0205ab6b1a5112689f17c53ce30 Mon Sep 17 00:00:00 2001
|
|
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
|
|
index 1daba4e..db33c98 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
|
|
@@ -50,6 +50,21 @@ public class EntityTNTPrimed extends Entity {
|
|
|
|
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;
|
|
@@ -97,7 +112,19 @@ public class EntityTNTPrimed extends Entity {
|
|
server.getPluginManager().callEvent(event);
|
|
|
|
if (!event.isCancelled()) {
|
|
- this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
|
+ // 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;
|
|
+
|
|
+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
|
+
|
|
+ chunkProvider.forceChunkLoad = before;
|
|
+ } else {
|
|
+ this.world.createExplosion(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, event.getRadius(), event.getFire(), true);
|
|
+ }
|
|
+ // PaperSpigot end
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
|
index f507134..aec39a8 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1641,6 +1641,17 @@ public abstract class World implements IBlockAccess {
|
|
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
|
|
index e14e961..f51962e 100644
|
|
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
|
|
@@ -265,4 +265,14 @@ public class PaperSpigotWorldConfig
|
|
{
|
|
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;
|
|
}
|
|
--
|
|
2.4.2.windows.1
|
|
|