Ensure mobs don't spawn out of world border

this is originally what I thought #1333 was, but wasn't, but this is still valid fix
This commit is contained in:
Aikar 2018-09-17 21:50:02 -04:00
parent 03c8b8ec27
commit fcc2e46edd
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
33 changed files with 158 additions and 151 deletions

View File

@ -1,4 +1,4 @@
From da7880ca6732b6f859467ba9a7097ae3562c8b34 Mon Sep 17 00:00:00 2001
From 8a51de86a66826f23e215c402a36e92d4fc84894 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 18 Mar 2016 20:16:03 -0400
Subject: [PATCH] Add World Util Methods
@ -54,7 +54,7 @@ index ac85986a1a..06c5a54254 100644
};
Stream stream = StreamSupport.stream(BlockPosition.MutableBlockPosition.b(i, k, i1, j - 1, l - 1, j1 - 1).spliterator(), false).map((blockposition$mutableblockposition) -> {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 561bcd07b3..94872593b1 100644
index 19eb905979..275978de83 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -84,7 +84,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -66,11 +66,14 @@ index 561bcd07b3..94872593b1 100644
protected int m = (new Random()).nextInt();
protected final int n = 1013904223;
protected float o;
@@ -274,6 +274,77 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -274,6 +274,83 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return this.getType(blockposition).isAir();
}
+ // Paper start
+ public boolean isLoadedAndInBounds(BlockPosition blockposition) {
+ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
+ }
+ public Chunk getChunkIfLoaded(BlockPosition blockposition) {
+ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
+ }
@ -109,6 +112,9 @@ index 561bcd07b3..94872593b1 100644
+ }
+ }
+ // reduces need to do isLoaded before getType
+ public IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) {
+ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null;
+ }
+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) {
+ // CraftBukkit start - tree generation
+ if (captureTreeGeneration) {
@ -145,5 +151,5 @@ index 561bcd07b3..94872593b1 100644
return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4);
}
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 967f13508fd86db7959565e2d32ae2b7231a2e19 Mon Sep 17 00:00:00 2001
From 563bf91958f3a6f200cc977abe04ad5bd92dd388 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 3 Mar 2016 02:07:55 -0600
Subject: [PATCH] Optimize isValidLocation, getType and getBlockData for inling
@ -97,7 +97,7 @@ index 274c449480..7e4c79a1ce 100644
private NibbleArray skyLight;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index d531dfcb8a..5031ee3fca 100644
index 275978de83..cad60e4f8b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -263,11 +263,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -114,7 +114,7 @@ index d531dfcb8a..5031ee3fca 100644
}
public boolean isEmpty(BlockPosition blockposition) {
@@ -281,7 +281,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -284,7 +284,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// test if meets light level, return faster
// logic copied from below
public boolean isLightLevel(BlockPosition blockposition, int level) {
@ -123,7 +123,7 @@ index d531dfcb8a..5031ee3fca 100644
if (this.getType(blockposition).c(this, blockposition)) {
int sky = getSkylightSubtracted();
if (this.getLightLevel(blockposition.up(), sky) >= level) {
@@ -325,7 +325,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -331,7 +331,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// CraftBukkit end
Chunk chunk = this.getChunkIfLoaded(blockposition);
if (chunk != null) {
@ -132,7 +132,7 @@ index d531dfcb8a..5031ee3fca 100644
}
return null;
}
@@ -380,7 +380,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -386,7 +386,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return true;
}
// CraftBukkit end
@ -141,7 +141,7 @@ index d531dfcb8a..5031ee3fca 100644
return false;
} else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
return false;
@@ -701,11 +701,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -707,11 +707,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ());
}
@ -155,7 +155,7 @@ index d531dfcb8a..5031ee3fca 100644
if (this.isLoaded(blockposition)) {
this.getChunkAtWorldCoords(blockposition).a(enumskyblock, blockposition, i);
this.m(blockposition);
@@ -732,7 +732,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -738,7 +738,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}
// CraftBukkit end
@ -164,7 +164,7 @@ index d531dfcb8a..5031ee3fca 100644
return Blocks.VOID_AIR.getBlockData();
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
@@ -742,7 +742,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -748,7 +748,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public Fluid b(BlockPosition blockposition) {
@ -173,7 +173,7 @@ index d531dfcb8a..5031ee3fca 100644
return FluidTypes.a.i();
} else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition);
@@ -1810,7 +1810,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1816,7 +1816,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public Map<BlockPosition, TileEntity> capturedTileEntities = Maps.newHashMap();
@Nullable
public TileEntity getTileEntity(BlockPosition blockposition) {
@ -182,7 +182,7 @@ index d531dfcb8a..5031ee3fca 100644
return null;
} else {
// CraftBukkit start
@@ -1851,7 +1851,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1857,7 +1857,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) {
@ -191,7 +191,7 @@ index d531dfcb8a..5031ee3fca 100644
if (tileentity != null && !tileentity.x()) {
// CraftBukkit start
if (captureBlockStates) {
@@ -1912,7 +1912,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1918,7 +1918,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public boolean p(BlockPosition blockposition) {

View File

@ -1,4 +1,4 @@
From ad72279171cbc841b7cc23ea948ff03cb2963b80 Mon Sep 17 00:00:00 2001
From 15b4f830be7e3b1e668873ee8953aadf68439d4a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 19:55:45 -0400
Subject: [PATCH] Option to disable BlockPhysicsEvent for Redstone
@ -11,7 +11,7 @@ Defaulting this to false will provide substantial performance improvement
by saving millions of event calls on redstone heavy servers.
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b05277067a..5f3156af60 100644
index f7be165301..59436c208a 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -220,4 +220,9 @@ public class PaperWorldConfig {
@ -25,10 +25,10 @@ index b05277067a..5f3156af60 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 45b0880607..8f3b1d529a 100644
index cad60e4f8b..22f0673743 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -614,7 +614,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -620,7 +620,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
try {
// CraftBukkit start
CraftWorld world = ((WorldServer) this).getWorld();
@ -38,7 +38,7 @@ index 45b0880607..8f3b1d529a 100644
this.getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 253019d89b..8f704a0e0b 100644
index a7cc053dc8..c5201697d5 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -37,6 +37,7 @@ import org.bukkit.event.weather.LightningStrikeEvent;
@ -58,5 +58,5 @@ index 253019d89b..8f704a0e0b 100644
}
--
2.18.0
2.19.0

View File

@ -1,14 +1,14 @@
From 1ca39c0a68a24dba5575712be65b4cbd7502c785 Mon Sep 17 00:00:00 2001
From 782de7ab3e7d34f4181da096d22a103eb3078a7a Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 28 Mar 2016 20:32:58 -0400
Subject: [PATCH] Entity AddTo/RemoveFrom World Events
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 5471528c22..a252e657c3 100644
index 22f0673743..207f53a9c3 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1076,6 +1076,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1082,6 +1082,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
entity.valid = true; // CraftBukkit
@ -16,7 +16,7 @@ index 5471528c22..a252e657c3 100644
}
protected void c(Entity entity) {
@@ -1083,6 +1084,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1089,6 +1090,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
((IWorldAccess) this.v.get(i)).b(entity);
}

View File

@ -1,4 +1,4 @@
From 883ae24227ae7d3d77fb1cdf092799df76d9841e Mon Sep 17 00:00:00 2001
From 3ab90e2a7588d50861f13f319df4e6854c893d80 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Thu, 31 Mar 2016 19:17:58 -0400
Subject: [PATCH] Do not load chunks for light checks
@ -7,10 +7,10 @@ Should only happen for blocks on the edge that uses neighbors light level
(certain blocks). In that case, there will be 3-4 other neighbors to get a light level from.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7f39a321db..c862f36628 100644
index 207f53a9c3..b8fcfb6092 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -657,6 +657,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -663,6 +663,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (blockposition.getY() >= 256) {
blockposition = new BlockPosition(blockposition.getX(), 255, blockposition.getZ());
}
@ -19,5 +19,5 @@ index 7f39a321db..c862f36628 100644
return this.getChunkAtWorldCoords(blockposition).a(blockposition, i);
}
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From b1a77b3b388cf9701837f28106674433f30321f9 Mon Sep 17 00:00:00 2001
From 390de8da32a8dbc419498a9383b24f71f93a7c11 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 13 Sep 2014 23:14:43 -0400
Subject: [PATCH] Configurable Keep Spawn Loaded range per world
@ -63,10 +63,10 @@ index bbd476bb0e..280e684db4 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 15c44293c7..48772f2163 100644
index b8fcfb6092..411cfedd25 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2875,8 +2875,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2881,8 +2881,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int k = i * 16 + 8 - blockposition.getX();
int l = j * 16 + 8 - blockposition.getZ();
boolean flag = true;

View File

@ -1,14 +1,14 @@
From dd72bc7341350bed6ef8855f5bd89d99a4504a3c Mon Sep 17 00:00:00 2001
From 9aa96ab2ab9656b172f1562f9fe6234b5426f009 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sun, 3 Apr 2016 17:48:50 -0400
Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index bbfa92e85f..0cdebf702a 100644
index 411cfedd25..b4274cf0ec 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -572,6 +572,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -578,6 +578,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
public void applyPhysics(BlockPosition blockposition, Block block) {
@ -17,5 +17,5 @@ index bbfa92e85f..0cdebf702a 100644
this.a(blockposition.east(), block, blockposition);
this.a(blockposition.down(), block, blockposition);
--
2.18.0
2.19.0

View File

@ -1,14 +1,14 @@
From 84cabace57b32008571dee8b4b884825b446f045 Mon Sep 17 00:00:00 2001
From 9c6d4121a51b48f1ec000fd2ad83947847a3cfcb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 5 Apr 2016 19:42:22 -0400
Subject: [PATCH] Don't spam reload spawn chunks in nether/end
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 389ef2aa9d..bace4bff75 100644
index b4274cf0ec..796ce3103a 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -2871,6 +2871,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2877,6 +2877,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return this.K;
}
@ -16,7 +16,7 @@ index 389ef2aa9d..bace4bff75 100644
public boolean e(int i, int j) {
BlockPosition blockposition = this.getSpawn();
int k = i * 16 + 8 - blockposition.getX();
@@ -2887,6 +2888,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2893,6 +2894,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return (LongSet) (forcedchunk != null ? LongSets.unmodifiable(forcedchunk.a()) : LongSets.EMPTY_SET);
}

View File

@ -1,4 +1,4 @@
From bb66308e3e6de4bc8b65cf582a5c268aa3a40bd6 Mon Sep 17 00:00:00 2001
From cccb296c07e9a0e29a68c3b592277a3209d106de Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 13 Apr 2016 00:25:28 -0400
Subject: [PATCH] Remove unused World Tile Entity List
@ -6,7 +6,7 @@ Subject: [PATCH] Remove unused World Tile Entity List
Massive hit to performance and it is completely unnecessary.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4bed101c08..c8c89d6ef3 100644
index 796ce3103a..261ae87fb8 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -76,7 +76,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -18,7 +18,7 @@ index 4bed101c08..c8c89d6ef3 100644
public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
private final List<TileEntity> c = Lists.newArrayList();
private final Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); // Paper
@@ -1312,7 +1312,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1318,7 +1318,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {
this.tileEntityListTick.removeAll(this.tileEntityListUnload);
@ -27,7 +27,7 @@ index 4bed101c08..c8c89d6ef3 100644
this.tileEntityListUnload.clear();
}
@@ -1365,7 +1365,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1371,7 +1371,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (tileentity.x()) {
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
@ -36,7 +36,7 @@ index 4bed101c08..c8c89d6ef3 100644
if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).d(tileentity.getPosition());
}
@@ -1395,7 +1395,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1401,7 +1401,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
// CraftBukkit start
// From above, don't screw this up - SPIGOT-1746
@ -45,7 +45,7 @@ index 4bed101c08..c8c89d6ef3 100644
this.a(tileentity1);
}
// CraftBukkit end
@@ -1415,9 +1415,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1421,9 +1421,9 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
protected void p_() {}
public boolean a(TileEntity tileentity) {
@ -57,7 +57,7 @@ index 4bed101c08..c8c89d6ef3 100644
this.tileEntityListTick.add(tileentity);
}
@@ -1898,7 +1898,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1904,7 +1904,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
} else {
if (tileentity != null) {
this.c.remove(tileentity);

View File

@ -1,4 +1,4 @@
From 838891ffd3bdbc81e429f285900af224acba96cf Mon Sep 17 00:00:00 2001
From 99e93943b43879cdc1449e499a4aeb3e6529cb41 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 29 Apr 2016 20:02:00 -0400
Subject: [PATCH] Improve Maps (in item frames) performance and bug fixes
@ -43,10 +43,10 @@ index 5c75d494a2..6120c63a38 100644
ItemStack itemstack = entityitemframe.getItem();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c8c89d6ef3..c6e9d697b4 100644
index 261ae87fb8..785f020652 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1116,6 +1116,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1122,6 +1122,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
{
if ( iter.next().trackee == entity )
{

View File

@ -1,4 +1,4 @@
From e90dbe5958240c16dc0f95d7b794d23c564cda27 Mon Sep 17 00:00:00 2001
From e1715b19fc47bbad627dadce371634570c9f029b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 18 Jun 2016 23:22:12 -0400
Subject: [PATCH] Delay Chunk Unloads based on Player Movement
@ -132,10 +132,10 @@ index a69d510dd1..7b67fa3208 100644
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c6e9d697b4..4cee3739bb 100644
index 785f020652..d31101861c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1336,7 +1336,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1342,7 +1342,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (!tileentity.x() && tileentity.hasWorld()) {
BlockPosition blockposition = tileentity.getPosition();

View File

@ -1,4 +1,4 @@
From 29fec89fc0e4511fd774cba43f5314a66a2f419e Mon Sep 17 00:00:00 2001
From 009ed21b65fa5fd70773813da89fde40d26e22ff Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 21 Jun 2016 22:54:34 -0400
Subject: [PATCH] Fix Double World Add issues
@ -21,10 +21,10 @@ index e831ea1429..d40d9d1173 100644
Iterator iterator = entity.bP().iterator();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b4f31c9310..6e1a396abc 100644
index d31101861c..a81c7dfa2e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -987,6 +987,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -993,6 +993,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
public boolean addEntity(Entity entity, SpawnReason spawnReason) { // Changed signature, added SpawnReason
org.spigotmc.AsyncCatcher.catchOp( "entity add"); // Spigot
if (entity == null) return false;
@ -33,5 +33,5 @@ index b4f31c9310..6e1a396abc 100644
org.bukkit.event.Cancellable event = null;
if (entity instanceof EntityLiving && !(entity instanceof EntityPlayer)) {
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 88abfc2741ad294c9ac4e4837cdcae53b01f5ded Mon Sep 17 00:00:00 2001
From 3e2bca5db612a593ee3a6319109f4c02b9193479 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 22:54:28 -0400
Subject: [PATCH] Chunk registration fixes
@ -8,10 +8,10 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr
Keep them consistent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f13ff979b0..c42c6c742f 100644
index a81c7dfa2e..3740cdf95d 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1516,7 +1516,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1522,7 +1522,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
i = MathHelper.floor(entity.locX / 16.0D);

View File

@ -1,4 +1,4 @@
From e7ea340cf92a564e8eec4d6e46ca6be9d60b8db0 Mon Sep 17 00:00:00 2001
From 51ad0411273acff4528a2e9ed3668e0345403918 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 2 Dec 2016 00:11:43 -0500
Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
@ -6,7 +6,7 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for World.isLoaded(BlockPosition)Z
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0fd91a687e..0cf5d80899 100644
index 3740cdf95d..785611f0e2 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -274,6 +274,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -18,8 +18,8 @@ index 0fd91a687e..0cf5d80899 100644
+ }
+
// Paper start
public Chunk getChunkIfLoaded(BlockPosition blockposition) {
return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4);
public boolean isLoadedAndInBounds(BlockPosition blockposition) {
return getWorldBorder().isInBounds(blockposition) && getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null;
--
2.18.0
2.19.0

View File

@ -1,14 +1,14 @@
From ad869815dee91aaa85cb8be64451e2df9410666c Mon Sep 17 00:00:00 2001
From 98c552a3eff39286f469e94894e6464d1443a604 Mon Sep 17 00:00:00 2001
From: mezz <tehgeek@gmail.com>
Date: Wed, 9 Aug 2017 17:51:22 -0500
Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4b53478d77..a6e87835d5 100644
index 785611f0e2..b17215edf4 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1317,7 +1317,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1323,7 +1323,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.methodProfiler.c("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -1,4 +1,4 @@
From ee464e6d1ed11829ed08eb96e5b0deaf4614a74e Mon Sep 17 00:00:00 2001
From b8dbed69eb629dc2d14c9ea39035c46a81e9922f Mon Sep 17 00:00:00 2001
From: Brokkonaut <hannos17@gmx.de>
Date: Tue, 31 Oct 2017 03:26:18 +0100
Subject: [PATCH] Send attack SoundEffects only to players who can see the
@ -6,7 +6,7 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 4ac310ba..1b7adbf4 100644
index 4ac310bae1..1b7adbf4ba 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -996,6 +996,15 @@ public abstract class EntityHuman extends EntityLiving {
@ -72,10 +72,10 @@ index 4ac310ba..1b7adbf4 100644
entity.extinguish();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 94e91d6e..3c8af077 100644
index b17215edf4..7712ee9db0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -948,6 +948,12 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -954,6 +954,12 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.a(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1);
}
@ -89,5 +89,5 @@ index 94e91d6e..3c8af077 100644
for (int i = 0; i < this.v.size(); ++i) {
((IWorldAccess) this.v.get(i)).a(entityhuman, soundeffect, soundcategory, d0, d1, d2, f, f1);
--
2.18.0.windows.1
2.19.0

View File

@ -1,4 +1,4 @@
From 6b0122321de7304bfea1554d803e68672966274d Mon Sep 17 00:00:00 2001
From 4dcc46cb2f4f833fe2302e954c6b7e6a2ce41de4 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Fri, 10 Nov 2017 23:03:12 -0500
Subject: [PATCH] Option for maximum exp value when merging orbs
@ -20,10 +20,10 @@ index 22af662ff3..9864c95a8c 100644
+ }
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9f6027d5e4..a6d5fb7c73 100644
index 7712ee9db0..564f2aecdf 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1026,16 +1026,32 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1032,16 +1032,32 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
EntityExperienceOrb xp = (EntityExperienceOrb) entity;
double radius = spigotConfig.expMerge;
if (radius > 0) {
@ -60,5 +60,5 @@ index 9f6027d5e4..a6d5fb7c73 100644
} // Spigot end
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From ed331c984a7c09f15bc7e4c1e904b3f06d90ba7e Mon Sep 17 00:00:00 2001
From 17ae634a0b7c6e945ce69e452e9b033913a167ea Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Thu, 16 Nov 2017 12:12:41 +0000
Subject: [PATCH] use CB BlockState implementations for captured blocks
@ -18,10 +18,10 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a6d5fb7c73..08aab08ec2 100644
index 564f2aecdf..f80f075287 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -395,7 +395,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -401,7 +401,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// CraftBukkit start - capture blockstates
CraftBlockState blockstate = null;
if (this.captureBlockStates) {
@ -31,5 +31,5 @@ index a6d5fb7c73..08aab08ec2 100644
}
// CraftBukkit end
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 97a51fb15c9f072778dfe97bf438633c5ccef933 Mon Sep 17 00:00:00 2001
From e6432da62947acb92d51fdda1b4fb4993a856afc Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 19 Dec 2017 22:57:26 -0500
Subject: [PATCH] ExperienceOrbMergeEvent
@ -8,10 +8,10 @@ Plugins can cancel this if they want to ensure experience orbs do not lose impor
metadata such as spawn reason, or conditionally move data from source to target.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 08aab08ec2..32c8fb4531 100644
index f80f075287..7cf4a9c11e 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1036,7 +1036,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1042,7 +1042,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (e instanceof EntityExperienceOrb) {
EntityExperienceOrb loopItem = (EntityExperienceOrb) e;
// Paper start
@ -21,5 +21,5 @@ index 08aab08ec2..32c8fb4531 100644
if ((int) newTotal < 0) continue; // Overflow
if (maxValue > 0 && newTotal > (long)maxValue) {
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 85ac3540d623320bc08f9f7877eb38f5db1ee813 Mon Sep 17 00:00:00 2001
From 40ca2e7602f37daf8e67ed9099c64941dfb6597e Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 4 Jul 2018 03:39:51 -0400
Subject: [PATCH] Avoid Chunk Lookups for Entity/TileEntity Current Chunk
@ -22,10 +22,10 @@ index 614fce4447..e806d13d22 100644
this.a(entity, entity.af);
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 946c129443..c695689101 100644
index 7cf4a9c11e..ee2cdb897c 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1252,12 +1252,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1258,12 +1258,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
int j;
// Paper start - Set based removal lists
for (Entity e : this.g) {
@ -42,7 +42,7 @@ index 946c129443..c695689101 100644
}
for (Entity e : this.g) {
@@ -1318,12 +1321,17 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1324,12 +1327,17 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.methodProfiler.e();
this.methodProfiler.a("remove");
if (entity.dead) {
@ -61,7 +61,7 @@ index 946c129443..c695689101 100644
guardEntityList = false; // Spigot
this.entityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
@@ -1368,7 +1376,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1374,7 +1382,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
BlockPosition blockposition = tileentity.getPosition();
// Paper start - Skip ticking in chunks scheduled for unload
@ -70,7 +70,7 @@ index 946c129443..c695689101 100644
boolean shouldTick = chunk != null;
if(this.paperConfig.skipEntityTickingInChunksScheduledForUnload)
shouldTick = shouldTick && chunk.scheduledForUnload == null;
@@ -1404,8 +1412,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1410,8 +1418,11 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--);
//this.tileEntityList.remove(tileentity); // Paper - remove unused list

View File

@ -1,4 +1,4 @@
From e2bed98381552f85e0d324e83e646675eba213bc Mon Sep 17 00:00:00 2001
From 242b6374788a22103f044df633362fa680011ee3 Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 12:57:39 +0200
Subject: [PATCH] Option to prevent armor stands from doing entity lookups
@ -21,10 +21,10 @@ index 3aa6f031f3..58f87794d6 100644
private void maxEntityCollision() {
maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) );
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 03896807f5..a0e1eb3ff1 100644
index 956eabd7dc..6605449a8b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1606,6 +1606,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1612,6 +1612,14 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}

View File

@ -1,11 +1,11 @@
From f406c64032ba93f6307424288ee6e521e2c36c19 Mon Sep 17 00:00:00 2001
From 84cd96aafcb42e4829f7fa42f2a6ac41c4832652 Mon Sep 17 00:00:00 2001
From: Hugo Manrique <hugmanrique@gmail.com>
Date: Mon, 23 Jul 2018 14:22:26 +0200
Subject: [PATCH] Vanished players don't have rights
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 46399cc9b..fdc9d96c2 100644
index 46399cc9b0..fdc9d96c27 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -94,7 +94,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -18,7 +18,7 @@ index 46399cc9b..fdc9d96c2 100644
protected int k;
private Entity vehicle;
diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java
index 24ce9137a..bf06a9031 100644
index 24ce9137ae..bf06a90312 100644
--- a/src/main/java/net/minecraft/server/IBlockData.java
+++ b/src/main/java/net/minecraft/server/IBlockData.java
@@ -165,6 +165,7 @@ public interface IBlockData extends IBlockDataHolder<IBlockData> {
@ -30,7 +30,7 @@ index 24ce9137a..bf06a9031 100644
return this.getBlock().f(this, iblockaccess, blockposition);
}
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 1cecccef2..afc881d9a 100644
index 1cecccef23..afc881d9af 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -70,7 +70,8 @@ public class ItemBlock extends Item {
@ -44,7 +44,7 @@ index 1cecccef2..afc881d9a 100644
BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), CraftBlockData.fromData(iblockdata), defaultReturn);
blockactioncontext.getWorld().getServer().getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java
index ea8f1c170..fdfc0d442 100644
index ea8f1c170a..fdfc0d442e 100644
--- a/src/main/java/net/minecraft/server/VoxelShape.java
+++ b/src/main/java/net/minecraft/server/VoxelShape.java
@@ -24,6 +24,7 @@ public abstract class VoxelShape {
@ -64,10 +64,10 @@ index ea8f1c170..fdfc0d442 100644
return this.a.a();
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 802a3e43d..cb878ced7 100644
index 6605449a8b..81777fce64 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1588,6 +1588,37 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1594,6 +1594,37 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}
@ -106,7 +106,7 @@ index 802a3e43d..cb878ced7 100644
if (voxelshape.b()) {
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ea787a523..77c6c0ec1 100644
index ea787a523c..77c6c0ec16 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -820,6 +820,14 @@ public class CraftEventFactory {

View File

@ -1,4 +1,4 @@
From 318c5e0b3498e6f215d35d845d950dd6bb6424eb Mon Sep 17 00:00:00 2001
From b2ff0d1f1033ce1fd4b2f4ff692817b76d5ccaeb Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:09:20 -0400
Subject: [PATCH] Always process chunk removal in removeEntity
@ -8,10 +8,10 @@ which can keep them in the chunk when they shouldnt be if done
during entity ticking.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 887dba69ce..f21c7f8d90 100644
index 81777fce64..597169b4cc 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1166,7 +1166,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1172,7 +1172,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.everyoneSleeping();
}
@ -20,7 +20,7 @@ index 887dba69ce..f21c7f8d90 100644
int i = entity.ae;
int j = entity.ag;
@@ -1174,6 +1174,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1180,6 +1180,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.getChunkAt(i, j).b(entity);
}

View File

@ -1,4 +1,4 @@
From a558c61927e16dc35e3b766288e22aea83e0fd1b Mon Sep 17 00:00:00 2001
From c21ec8930d87437aaf3ea6a85b09b599b0eb4589 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Sat, 28 Jul 2018 12:18:27 -0400
Subject: [PATCH] Ignore Dead Entities in entityList iteration
@ -35,10 +35,10 @@ index 8951ac8095..127a7c9b72 100644
public float length;
public float J;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index fe81d4c7fc..653d594a6b 100644
index 597169b4cc..b18ea7154f 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1105,6 +1105,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1111,6 +1111,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
entity.valid = true; // CraftBukkit
@ -46,7 +46,7 @@ index fe81d4c7fc..653d594a6b 100644
new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid
}
@@ -1173,6 +1174,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1179,6 +1180,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (entity.inChunk && this.isChunkLoaded(i, j, true)) {
this.getChunkAt(i, j).b(entity);
}
@ -54,7 +54,7 @@ index fe81d4c7fc..653d594a6b 100644
if (!guardEntityList) { // Spigot - It will get removed after the tick if we are ticking // Paper - always remove from current chunk above
// CraftBukkit start - Decrement loop variable field if we've already ticked this entity
@@ -2383,6 +2385,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2389,6 +2391,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
@ -62,7 +62,7 @@ index fe81d4c7fc..653d594a6b 100644
if (oclass.isAssignableFrom(entity.getClass()) && predicate.test((T) entity)) {
arraylist.add(entity);
@@ -2469,6 +2472,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2475,6 +2478,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();

View File

@ -1,11 +1,11 @@
From 7fc92c942588e2aaf3fa6c39a3b273310e63791c Mon Sep 17 00:00:00 2001
From 3b72e7847d2396655fb55ffa0e2d70a475e71977 Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Mon, 30 Jul 2018 02:42:49 -0400
Subject: [PATCH] World EntityHuman Lookup Optimizations
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 653d594a6b..527cf942c8 100644
index b18ea7154f..aa94e399af 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -81,6 +81,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -16,7 +16,7 @@ index 653d594a6b..527cf942c8 100644
public final List<Entity> k = Lists.newArrayList();
protected final IntHashMap<Entity> entitiesById = new IntHashMap();
private final long F = 16777215L;
@@ -1089,6 +1090,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1095,6 +1096,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
EntityHuman entityhuman = (EntityHuman) entity;
this.players.add(entityhuman);
@ -25,7 +25,7 @@ index 653d594a6b..527cf942c8 100644
this.everyoneSleeping();
}
@@ -1131,6 +1134,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1137,6 +1140,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@ -33,7 +33,7 @@ index 653d594a6b..527cf942c8 100644
// Spigot start
for ( WorldPersistentData worldData : worldMaps.a.values() )
{
@@ -1164,6 +1168,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1170,6 +1174,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
entity.die();
if (entity instanceof EntityHuman) {
this.players.remove(entity);
@ -41,7 +41,7 @@ index 653d594a6b..527cf942c8 100644
this.everyoneSleeping();
}
@@ -2713,6 +2718,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2719,6 +2724,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@Nullable
public EntityHuman a(String s) {
@ -50,7 +50,7 @@ index 653d594a6b..527cf942c8 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2722,10 +2729,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2728,10 +2735,15 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
return null;
@ -66,7 +66,7 @@ index 653d594a6b..527cf942c8 100644
for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman = (EntityHuman) this.players.get(i);
@@ -2735,6 +2747,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2741,6 +2753,10 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
return null;

View File

@ -1,4 +1,4 @@
From 509879ae5b406f8f259396441e29698419b6aa04 Mon Sep 17 00:00:00 2001
From f2d6b77d7f061d9dc7ceb3fce2f58a25f33f3fc0 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Fri, 3 Aug 2018 22:47:46 -0400
Subject: [PATCH] Entity add to world fixes
@ -42,10 +42,10 @@ index e8af8f4196..56c3783412 100644
// CraftBukkit start
org.bukkit.Server server = this.world.getServer();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 527cf942c8..c565e46226 100644
index aa94e399af..85570e4a5d 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1096,6 +1096,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1102,6 +1102,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
this.getChunkAt(i, j).a(entity);
@ -53,7 +53,7 @@ index 527cf942c8..c565e46226 100644
this.entityList.add(entity);
this.b(entity);
return true;
@@ -2501,9 +2502,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2507,9 +2508,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return j;
}

View File

@ -1,4 +1,4 @@
From 0f31bf2ce8e0e92ccf40826a80d2ecd698f7af0f Mon Sep 17 00:00:00 2001
From 9baa8594c726c12cde2138f825f10fc4b71e5eed Mon Sep 17 00:00:00 2001
From: Colin Godsey <crgodsey@gmail.com>
Date: Wed, 8 Aug 2018 10:10:06 -0600
Subject: [PATCH] Cache World Entity Type counts
@ -183,7 +183,7 @@ index 95d98b65cf..387570ed67 100644
if (l1 <= k) {
BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2b7ab82b11..4089204308 100644
index 85570e4a5d..39175ea0ad 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -50,7 +50,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -213,7 +213,7 @@ index 2b7ab82b11..4089204308 100644
public static boolean haveWeSilencedAPhysicsCrash;
public static String blockLocation;
private org.spigotmc.TickLimiter entityLimiter;
@@ -1181,6 +1183,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -1187,6 +1189,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
this.getChunkAt(i, j).b(entity);
}
entity.shouldBeRemoved = true; // Paper

View File

@ -1,14 +1,14 @@
From e951f400f5d3718775c296babb9daa0b8d565e0b Mon Sep 17 00:00:00 2001
From ef21b6d2fc86771ebcc7af33e97e1b952731235f Mon Sep 17 00:00:00 2001
From: Sotr <i@omc.hk>
Date: Thu, 23 Aug 2018 16:14:12 +0800
Subject: [PATCH] Add source block to BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c479828d49..20bead54bf 100644
index 39175ea0ad..4426798c74 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -623,7 +623,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -629,7 +629,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// CraftBukkit start
CraftWorld world = ((WorldServer) this).getWorld();
if (world != null && !((WorldServer)this).stopPhysicsEvent) { // Paper
@ -18,5 +18,5 @@ index c479828d49..20bead54bf 100644
if (event.isCancelled()) {
--
2.18.0
2.19.0

View File

@ -1,4 +1,4 @@
From 4ebd487261fd788fcb42a4d09d156e5acdf50ccd Mon Sep 17 00:00:00 2001
From d64e69f6935741d935029143b1cb8046c2155405 Mon Sep 17 00:00:00 2001
From: stonar96 <minecraft.stonar96@gmail.com>
Date: Mon, 20 Aug 2018 03:03:58 +0200
Subject: [PATCH] Anti-Xray
@ -1071,7 +1071,7 @@ index 56c3783412..f3d9211baa 100644
this.initLighting();
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 93bc613958..31faeb43f6 100644
index 7db075b731..c2007b4d0c 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -857,7 +857,7 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
@ -1511,7 +1511,7 @@ index 688b4ab8be..f78d5fbb86 100644
if (enumskyblock == EnumSkyBlock.SKY) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 20bead54bf..49809372d8 100644
index 4426798c74..650e605b5b 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1,6 +1,8 @@
@ -1539,7 +1539,7 @@ index 20bead54bf..49809372d8 100644
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -404,6 +408,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -410,6 +414,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
// CraftBukkit end
IBlockData iblockdata1 = chunk.a(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag
@ -1573,5 +1573,5 @@ index c26f0ed16b..f6915d32ab 100644
return section;
}
--
2.18.0
2.19.0

View File

@ -1,14 +1,14 @@
From 1e714f533e5ec45ad8afd9da552948fd1324fe33 Mon Sep 17 00:00:00 2001
From a9234a415b098ba1ddf6cd3c67d7cd000521045c Mon Sep 17 00:00:00 2001
From: willies952002 <admin@domnian.com>
Date: Wed, 29 Aug 2018 00:37:42 -0400
Subject: [PATCH] Implement Force-Loaded Chunk API
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index b75ed5028d..15df2b44af 100644
index 650e605b5b..2ff8536d59 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -3017,6 +3017,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -3023,6 +3023,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
return forcedchunk != null && forcedchunk.a().contains(ChunkCoordIntPair.a(i, j));
}

View File

@ -1,4 +1,4 @@
From 0b22c6881db444da8b133a33b97bddff2d752a0b Mon Sep 17 00:00:00 2001
From ef38ead333d3bdd03afea499031df21f298d5919 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 29 Aug 2018 21:59:22 -0400
Subject: [PATCH] Optimize getChunkIfLoaded type calls
@ -23,7 +23,7 @@ index fc621911e0..99613b2ef3 100644
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9636b40f97..52d9c06805 100644
index 2ff8536d59..0c42d042b1 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -165,7 +165,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@ -35,7 +35,7 @@ index 9636b40f97..52d9c06805 100644
}
protected World(IDataManager idatamanager, @Nullable PersistentCollection persistentcollection, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag, ChunkGenerator gen, org.bukkit.World.Environment env) {
@@ -715,7 +715,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -721,7 +721,8 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
blockposition = new BlockPosition(blockposition.getX(), 0, blockposition.getZ());
}
@ -45,7 +45,7 @@ index 9636b40f97..52d9c06805 100644
}
public void a(EnumSkyBlock enumskyblock, BlockPosition blockposition, int i) {
@@ -2024,7 +2025,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -2030,7 +2031,7 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
if (blockposition.isInvalidYLocation()) { // Paper
return false;
} else {

View File

@ -1,4 +1,4 @@
From d084c3abef084cb894059e7755a1062d4aca0b24 Mon Sep 17 00:00:00 2001
From c2c5c415ea05a6b591c02a90cefddcbf0fb8d142 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Mon, 10 Sep 2018 23:56:36 -0400
Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks
@ -84,10 +84,10 @@ index 800e0046a8..bfa6c2eef8 100644
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index acd0c93cec..dbdda0a127 100644
index 0c42d042b1..e52e4bb458 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -756,6 +756,18 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
@@ -762,6 +762,18 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
}
}
@ -107,5 +107,5 @@ index acd0c93cec..dbdda0a127 100644
if (blockposition.isInvalidYLocation()) { // Paper
return FluidTypes.a.i();
--
2.18.0
2.19.0

View File

@ -1,11 +1,12 @@
From c3d2e0dd50ede77e547a3559419b45217c93afcb Mon Sep 17 00:00:00 2001
From 19c62991e8d96fd05203ccb3b23d8570ce4eca0b Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 12 Sep 2018 21:12:57 -0400
Subject: [PATCH] Prevent mob spawning from loading/generating chunks
also prevents if out of world border bounds
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 387570ed67..97ef41fe82 100644
index 387570ed67..fb57cb8394 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -129,9 +129,9 @@ public final class SpawnerCreature {
@ -13,7 +14,7 @@ index 387570ed67..97ef41fe82 100644
int j2 = blockposition1.getY();
int k2 = blockposition1.getZ();
- IBlockData iblockdata = worldserver.getType(blockposition1);
+ IBlockData iblockdata = worldserver.getTypeIfLoaded(blockposition1); // Paper - don't load chunks for mob spawn
+ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn
- if (!iblockdata.isOccluding()) {
+ if (iblockdata != null && !iblockdata.isOccluding()) { // Paper - don't load chunks for mob spawn
@ -25,7 +26,7 @@ index 387570ed67..97ef41fe82 100644
}
- if (worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) {
+ if (worldserver.isLoaded(blockposition_mutableblockposition) && worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
+ if (worldserver.isLoadedAndInBounds(blockposition_mutableblockposition) && worldserver.a(enumcreaturetype, biomebase_biomemeta, (BlockPosition) blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn
EntityPositionTypes.Surface entitypositiontypes_surface = EntityPositionTypes.a(biomebase_biomemeta.b);
if (entitypositiontypes_surface != null && a(entitypositiontypes_surface, worldserver, blockposition_mutableblockposition, biomebase_biomemeta.b)) {
EntityInsentient entityinsentient;