Workaround for some hacky environments that mess up things

2 people had issues where some plugin is doing some reallly insane NMS hackery
that created invalid worlds, which caused some errors...

Really don't understand what in the world they did, but putting in a dumb guard that
shouldn't even be necessary to just not send the sound effect rather than erroring.
This commit is contained in:
Aikar 2020-05-23 22:27:37 -04:00
parent 8b2a437b9e
commit 10502558e9
No known key found for this signature in database
GPG Key ID: 401ADFC9891FAAFE
33 changed files with 102 additions and 91 deletions

View File

@ -3005,19 +3005,17 @@ index 774a8f543424853be5fc8c0367d734ddf196d7f9..d5f5a51872dfabdbb828b6c20d61893a
this.a(); this.a();
packetdataserializer.writeByte(this.i); packetdataserializer.writeByte(this.i);
diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java diff --git a/src/main/java/net/minecraft/server/DimensionManager.java b/src/main/java/net/minecraft/server/DimensionManager.java
index 5724fe6e57d3671b4978aecaf217ac4c2e0d7f82..951db04bca7ee9021a5d4707f1907b2c8f734a92 100644 index 5724fe6e57d3671b4978aecaf217ac4c2e0d7f82..393bc4dc700bbf8653db0662c7957f676b0a647a 100644
--- a/src/main/java/net/minecraft/server/DimensionManager.java --- a/src/main/java/net/minecraft/server/DimensionManager.java
+++ b/src/main/java/net/minecraft/server/DimensionManager.java +++ b/src/main/java/net/minecraft/server/DimensionManager.java
@@ -55,7 +55,9 @@ public class DimensionManager implements MinecraftSerializable { @@ -55,6 +55,7 @@ public class DimensionManager implements MinecraftSerializable {
return this.folder.isEmpty() ? file : new File(file, this.folder); return this.folder.isEmpty() ? file : new File(file, this.folder);
} }
+ public WorldServer world; // Paper - store ref to world this manager is for + public WorldServer world; // Paper - store ref to world this manager is for
public WorldProvider getWorldProvider(World world) { public WorldProvider getWorldProvider(World world) {
+ if (this.world == null) this.world = (WorldServer) world; // Paper
return (WorldProvider) this.providerFactory.apply(world, this); return (WorldProvider) this.providerFactory.apply(world, this);
} }
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index f4863852b04c5fa55b79acabe40ce59909b9bbbd..7e01f6a1807f9885a7f4b163ce6bb626d8786a9a 100644 index f4863852b04c5fa55b79acabe40ce59909b9bbbd..7e01f6a1807f9885a7f4b163ce6bb626d8786a9a 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
@ -4361,7 +4359,7 @@ index 143be566c683ae035997f9a4058381a109f3de23..0e30d8c9933dc6595b9715ef6dc99cc8
return VoxelShapes.b; return VoxelShapes.b;
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2e1eabba14a3757d03fd90741651001e78c6322f..2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9 100644 index 2e1eabba14a3757d03fd90741651001e78c6322f..d9ff52eda71fcdf88d4c9114450237bcba2ccb08 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
@ -4372,7 +4370,15 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..2a4fa455ff3065f9b1ad9bcf8d236bbb
import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockPhysicsEvent;
// CraftBukkit end // CraftBukkit end
@@ -183,6 +184,39 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -94,6 +95,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
this.generator = gen;
+ dimensionmanager.world = (WorldServer) this; // Paper
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
@@ -183,6 +185,39 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL); return (Chunk) this.getChunkAt(i, j, ChunkStatus.FULL);
} }
@ -4412,7 +4418,7 @@ index 2e1eabba14a3757d03fd90741651001e78c6322f..2a4fa455ff3065f9b1ad9bcf8d236bbb
@Override @Override
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
IChunkAccess ichunkaccess = this.chunkProvider.getChunkAt(i, j, chunkstatus, flag); IChunkAccess ichunkaccess = this.chunkProvider.getChunkAt(i, j, chunkstatus, flag);
@@ -336,8 +370,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -336,8 +371,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}

View File

@ -1204,7 +1204,7 @@ index 820180ab3f7053c348caa80cc21f15dfa3d26afd..fa6400dccd4df635d696e0858c0c164a
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
public CraftPersistentDataContainer persistentDataContainer; public CraftPersistentDataContainer persistentDataContainer;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9..f572c5f22712288cc75fffeae65fc2bd632d2de1 100644 index d9ff52eda71fcdf88d4c9114450237bcba2ccb08..740c59004514a332ebe556c4e91f84bd9bf4a11d 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1,5 +1,7 @@ @@ -1,5 +1,7 @@
@ -1233,7 +1233,7 @@ index 2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9..f572c5f22712288cc75fffeae65fc2bd
public static BlockPosition lastPhysicsProblem; // Spigot public static BlockPosition lastPhysicsProblem; // Spigot
private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter entityLimiter;
private org.spigotmc.TickLimiter tileLimiter; private org.spigotmc.TickLimiter tileLimiter;
@@ -138,7 +140,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -139,7 +141,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public void c(WorldBorder worldborder, double d0) {} public void c(WorldBorder worldborder, double d0) {}
}); });
// CraftBukkit end // CraftBukkit end
@ -1242,7 +1242,7 @@ index 2a4fa455ff3065f9b1ad9bcf8d236bbb6f830bc9..f572c5f22712288cc75fffeae65fc2bd
this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime);
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
} }
@@ -722,15 +724,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -723,15 +725,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} }
timings.tileEntityPending.stopTiming(); // Spigot timings.tileEntityPending.stopTiming(); // Spigot

View File

@ -20,10 +20,10 @@ index 2845686411615245137cfe1a155088a865a4d3a0..8ee2b9bb1bce698fce50ac1b3fc477fc
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f572c5f22712288cc75fffeae65fc2bd632d2de1..0332aca8be854fca7444308b9ab5e43f01f8055e 100644 index 740c59004514a332ebe556c4e91f84bd9bf4a11d..b69d84baf8d318968ef171232e493a315f71814b 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -141,6 +141,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -142,6 +142,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}); });
// CraftBukkit end // CraftBukkit end
timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings

View File

@ -23,10 +23,10 @@ index fa6400dccd4df635d696e0858c0c164a0f19b4a4..e2f3cec7420edbd284b531ca7d1d1214
} }
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0332aca8be854fca7444308b9ab5e43f01f8055e..1bb36201544987cf44b9da2494e4cc54385f7e77 100644 index b69d84baf8d318968ef171232e493a315f71814b..ca3b4c9f2f7e1b5425e8be4c3d11e3e881915e8b 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -664,11 +664,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -665,11 +665,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.exit(); gameprofilerfiller.exit();
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -45,7 +45,7 @@ index 0332aca8be854fca7444308b9ab5e43f01f8055e..1bb36201544987cf44b9da2494e4cc54
} }
// Spigot start // Spigot start
finally { finally {
@@ -734,11 +736,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -735,11 +737,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
try { try {
consumer.accept(entity); consumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Disable spigot tick limiters
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 4604634577418be8382a3d84eaaa90869834c88f..4d849719f4b06dad40f96afd27c3ef32092b5bd0 100644 index 6dfefa3f9ebf6d2ad08ebe6ddd77ca6d95971544..65fc7105c8c93ccee569abb14ccba3f5cf75a7a8 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -634,9 +634,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -635,9 +635,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// Spigot start // Spigot start
// Iterator iterator = this.tileEntityListTick.iterator(); // Iterator iterator = this.tileEntityListTick.iterator();
int tilesThisCycle = 0; int tilesThisCycle = 0;

View File

@ -209,7 +209,7 @@ index d5e9bae7097460b44f9061198cf54b421bf2b3cf..1bcf01c09a9ba5168d491797e13eeddc
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6e8ac186c9975888fe7403506ad0724fb37ad26c..a6b2867094b6a757b4bc54a947b6972417845f2b 100644 index fc9bbc4fdd371931ea31c061b9bef0c4f91853d9..6e7d3573ed6f58a9c5f29c8b1b49746f13e21dc7 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -2,6 +2,9 @@ package net.minecraft.server; @@ -2,6 +2,9 @@ package net.minecraft.server;
@ -222,7 +222,7 @@ index 6e8ac186c9975888fe7403506ad0724fb37ad26c..a6b2867094b6a757b4bc54a947b69724
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;
@@ -664,8 +667,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -665,8 +668,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.exit(); gameprofilerfiller.exit();
} catch (Throwable throwable) { } catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes // Paper start - Prevent tile entity and entity crashes
@ -235,7 +235,7 @@ index 6e8ac186c9975888fe7403506ad0724fb37ad26c..a6b2867094b6a757b4bc54a947b69724
tilesThisCycle--; tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--); this.tileEntityListTick.remove(tileTickPosition--);
continue; continue;
@@ -736,8 +742,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -737,8 +743,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
consumer.accept(entity); consumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {
// Paper start - Prevent tile entity and entity crashes // Paper start - Prevent tile entity and entity crashes

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Add World Util Methods
Methods that can be used for other patches to help improve logic. Methods that can be used for other patches to help improve logic.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a6b2867094b6a757b4bc54a947b6972417845f2b..e7337fc368327876139f4610642a45321d0ecce2 100644 index 6e7d3573ed6f58a9c5f29c8b1b49746f13e21dc7..a721ad8addfd5a47608e304b372762d3ca89fa65 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -222,6 +222,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -223,6 +223,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return chunk == null ? null : chunk.getFluid(blockposition); return chunk == null ? null : chunk.getFluid(blockposition);
} }
@ -29,7 +29,7 @@ index a6b2867094b6a757b4bc54a947b6972417845f2b..e7337fc368327876139f4610642a4532
@Override @Override
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
index 020e5c171a44f8886395849d718efd6f90659bab..4ee13ac45483022417e08bb7a4461eb34b3ec84a 100644 index 3db276f176301ebf15d5a2ba44d0edb5c7ec6097..73730fe25c84a867b8d95525c9d76d60a5797396 100644
--- a/src/main/java/net/minecraft/server/WorldBorder.java --- a/src/main/java/net/minecraft/server/WorldBorder.java
+++ b/src/main/java/net/minecraft/server/WorldBorder.java +++ b/src/main/java/net/minecraft/server/WorldBorder.java
@@ -19,6 +19,7 @@ public class WorldBorder { @@ -19,6 +19,7 @@ public class WorldBorder {

View File

@ -77,10 +77,10 @@ index 638b0e39798a3f75566fcf9ea48b81024e60b471..e056fbcb216977401fd2778fcd3ee7ed
public ChunkSection(int i) { public ChunkSection(int i) {
this(i, (short) 0, (short) 0, (short) 0); this(i, (short) 0, (short) 0, (short) 0);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index e7337fc368327876139f4610642a45321d0ecce2..6b1ff8f64f87e1d5fc98fd9733d6b45d312c1f69 100644 index a721ad8addfd5a47608e304b372762d3ca89fa65..40a51633ed509ca7ae6131e11276f8f3cb7c03ce 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -171,11 +171,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -172,11 +172,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} }
public static boolean isValidLocation(BlockPosition blockposition) { public static boolean isValidLocation(BlockPosition blockposition) {

View File

@ -44,10 +44,10 @@ index a67c31a6021d881b49cfdb75f514404c342eea45..4c7df81217c10d92d05e619ad760bc5d
this.methodProfiler.a(() -> { this.methodProfiler.a(() -> {
return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 6b1ff8f64f87e1d5fc98fd9733d6b45d312c1f69..1edd03086535834fc68260f0ee6653d84764ce87 100644 index 40a51633ed509ca7ae6131e11276f8f3cb7c03ce..7278242d569dafd99984921a3a3b86de46d8287f 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -369,7 +369,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -370,7 +370,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit start // CraftBukkit start
iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam iblockdata1.b(this, blockposition, j); // Don't call an event for the old block to limit event spam
CraftWorld world = ((WorldServer) this).getWorld(); CraftWorld world = ((WorldServer) this).getWorld();
@ -56,7 +56,7 @@ index 6b1ff8f64f87e1d5fc98fd9733d6b45d312c1f69..1edd03086535834fc68260f0ee6653d8
BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata));
this.getServer().getPluginManager().callEvent(event); this.getServer().getPluginManager().callEvent(event);
@@ -481,7 +481,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -482,7 +482,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
try { try {
// CraftBukkit start // CraftBukkit start
CraftWorld world = ((WorldServer) this).getWorld(); CraftWorld world = ((WorldServer) this).getWorld();

View File

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 1edd03086535834fc68260f0ee6653d84764ce87..aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54 100644 index 7278242d569dafd99984921a3a3b86de46d8287f..491e491895246063c4df38e1a90693bfc730ef33 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -439,6 +439,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -440,6 +440,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
public void applyPhysics(BlockPosition blockposition, Block block) { public void applyPhysics(BlockPosition blockposition, Block block) {

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Remove unused World Tile Entity List
Massive hit to performance and it is completely unnecessary. 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c840a443c 100644 index 491e491895246063c4df38e1a90693bfc730ef33..a3de9ae44acb3736394ac97c730d1b1cc2d5b914 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -36,7 +36,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -36,7 +36,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -18,7 +18,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c
public final List<TileEntity> tileEntityListTick = Lists.newArrayList(); public final List<TileEntity> tileEntityListTick = Lists.newArrayList();
protected final List<TileEntity> tileEntityListPending = Lists.newArrayList(); protected final List<TileEntity> tileEntityListPending = Lists.newArrayList();
protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); protected final java.util.Set<TileEntity> tileEntityListUnload = com.google.common.collect.Sets.newHashSet();
@@ -604,9 +604,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -605,9 +605,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}, tileentity::getPosition}); }, tileentity::getPosition});
} }
@ -30,7 +30,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c
this.tileEntityListTick.add(tileentity); this.tileEntityListTick.add(tileentity);
} }
@@ -642,7 +642,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -643,7 +643,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
timings.tileEntityTick.startTiming(); // Spigot timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) { if (!this.tileEntityListUnload.isEmpty()) {
this.tileEntityListTick.removeAll(this.tileEntityListUnload); this.tileEntityListTick.removeAll(this.tileEntityListUnload);
@ -39,7 +39,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c
this.tileEntityListUnload.clear(); this.tileEntityListUnload.clear();
} }
@@ -703,7 +703,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -704,7 +704,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
tilesThisCycle--; tilesThisCycle--;
this.tileEntityListTick.remove(tileTickPosition--); this.tileEntityListTick.remove(tileTickPosition--);
// Spigot end // Spigot end
@ -48,7 +48,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c
if (this.isLoaded(tileentity.getPosition())) { if (this.isLoaded(tileentity.getPosition())) {
this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition()); this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition());
} }
@@ -733,7 +733,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -734,7 +734,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3); this.notify(tileentity1.getPosition(), iblockdata, iblockdata, 3);
// CraftBukkit start // CraftBukkit start
// From above, don't screw this up - SPIGOT-1746 // From above, don't screw this up - SPIGOT-1746
@ -57,7 +57,7 @@ index aaedbaf4d7eb7750b356e184ac4a4f5e38d91b54..0e8d31babd39857c2754c19ddc780f8c
this.a(tileentity1); this.a(tileentity1);
} }
// CraftBukkit end // CraftBukkit end
@@ -999,7 +999,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1000,7 +1000,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} else { } else {
if (tileentity != null) { if (tileentity != null) {
this.tileEntityListPending.remove(tileentity); this.tileEntityListPending.remove(tileentity);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z
Reduce method invocations for 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 86de3c634de0e9b9a320e1e71d2fb01fddd1a1e8..9632839598c0d6a24894780dd2f68b9abeb33a31 100644 index fd8724c755d4129c0f3fbd6e0730def09dba1e55..184ea74726078809ae1b6df320d37532fa0d26ab 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -224,6 +224,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -225,6 +225,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return chunk == null ? null : chunk.getFluid(blockposition); return chunk == null ? null : chunk.getFluid(blockposition);
} }

View File

@ -5,10 +5,10 @@ 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 9632839598c0d6a24894780dd2f68b9abeb33a31..14c97a163c53a9ca0fae55a01d2ca861712b1c07 100644 index 184ea74726078809ae1b6df320d37532fa0d26ab..08f22545393148e91bec3d4a091092eab6828711 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -647,7 +647,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -648,7 +648,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.enter("blockEntities"); gameprofilerfiller.enter("blockEntities");
timings.tileEntityTick.startTiming(); // Spigot timings.tileEntityTick.startTiming(); // Spigot
if (!this.tileEntityListUnload.isEmpty()) { if (!this.tileEntityListUnload.isEmpty()) {

View File

@ -72,10 +72,10 @@ index 8e5edd2c9b7cc9a441969efeb666061515188486..542f935b4e7a027b3df82f037fcd6523
entity.extinguish(); entity.extinguish();
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 14c97a163c53a9ca0fae55a01d2ca861712b1c07..a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c 100644 index 08f22545393148e91bec3d4a091092eab6828711..b3e01415110d6a714b6cd5a94bf747a1481d72ab 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -584,6 +584,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -585,6 +585,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1); this.playSound(entityhuman, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, soundeffect, soundcategory, f, f1);
} }

View File

@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping
information on restoration when the event is cancelled. 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 diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d8da41865 100644 index b3e01415110d6a714b6cd5a94bf747a1481d72ab..08bed18ad6f78c6aad444eeb5a321887d90e5829 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -66,7 +66,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -66,7 +66,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -30,7 +30,7 @@ index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d
public Map<BlockPosition, TileEntity> capturedTileEntities = new HashMap<>(); public Map<BlockPosition, TileEntity> capturedTileEntities = new HashMap<>();
public List<EntityItem> captureDrops; public List<EntityItem> captureDrops;
public long ticksPerAnimalSpawns; public long ticksPerAnimalSpawns;
@@ -257,7 +257,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -258,7 +258,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
if (this.captureTreeGeneration) { if (this.captureTreeGeneration) {
@ -39,7 +39,7 @@ index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d
if (blockstate == null) { if (blockstate == null) {
blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i);
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
@@ -277,7 +277,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -278,7 +278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit start - capture blockstates // CraftBukkit start - capture blockstates
boolean captured = false; boolean captured = false;
if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) { if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) {
@ -48,7 +48,7 @@ index a956dbc3d4ea1f20b0be28ed4f54f55474e89a5c..2f57c7bc76ddd8fd4b796d85eaa7200d
this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate);
captured = true; captured = true;
} }
@@ -545,7 +545,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -546,7 +546,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public IBlockData getType(BlockPosition blockposition) { public IBlockData getType(BlockPosition blockposition) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
if (captureTreeGeneration) { if (captureTreeGeneration) {

View File

@ -19,10 +19,10 @@ index 387e0dcb9f01ad947daaa19211331a96742ce004..eaaa51e4bf761f41fd516402ce1ad0f9
+ } + }
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a1c33c525ce8ae0f4736198658174f8d67ab6320..2261c42ab69e260d3533cdff1149b83acea8ccb4 100644 index 9a001a2a7934dc87f3e57d3388a8a888ec43908b..688d98dd1e6e5d2e17c8fc04e105fdc0ee649574 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -781,6 +781,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -782,6 +782,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} }
} }

View File

@ -97,10 +97,10 @@ index 0e30d8c9933dc6595b9715ef6dc99cc8910892cb..335142ec0dfad822cfe40877e99dec0f
if (operatorboolean.apply(false, false)) { if (operatorboolean.apply(false, false)) {
throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException()); throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException());
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 2261c42ab69e260d3533cdff1149b83acea8ccb4..378ac5ae86e337f27975bc7935c4f25fce767eaf 100644 index 688d98dd1e6e5d2e17c8fc04e105fdc0ee649574..037770cde15a72192f0f45fdac33f8bd66ba646c 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -152,6 +152,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -153,6 +153,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime);
} }

View File

@ -1127,10 +1127,10 @@ index 5bf2fc0b3f0a5209682b6056a6512ba9dbdca6d0..52a4982ecd7e4346e55c6fbab80032ed
c(iblockdata, world, blockposition); c(iblockdata, world, blockposition);
world.a(blockposition, false); world.a(blockposition, false);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 378ac5ae86e337f27975bc7935c4f25fce767eaf..f8619578422f9e1e5368c97588cc5ec265788a1d 100644 index 037770cde15a72192f0f45fdac33f8bd66ba646c..e3253bd36b08dc0963a69d8bd417c9f666ea4406 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -522,6 +522,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -523,6 +523,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} }
@ -1138,7 +1138,7 @@ index 378ac5ae86e337f27975bc7935c4f25fce767eaf..f8619578422f9e1e5368c97588cc5ec2
public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) {
if (!this.isClientSide) { if (!this.isClientSide) {
IBlockData iblockdata = this.getType(blockposition); IBlockData iblockdata = this.getType(blockposition);
@@ -1277,6 +1278,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1278,6 +1279,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0))));
} }

View File

@ -11,10 +11,10 @@ floating in the air.
This can replace many uses of BlockPhysicsEvent This can replace many uses of BlockPhysicsEvent
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f8619578422f9e1e5368c97588cc5ec265788a1d..a3fbdf5db5cd1f08e9920bbc786705f69f465efd 100644 index e3253bd36b08dc0963a69d8bd417c9f666ea4406..98ea9bb98a1a447e1ab8a54839d263ee1cad58ff 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -452,8 +452,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -453,8 +453,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return false; return false;
} else { } else {
Fluid fluid = this.getFluid(blockposition); Fluid fluid = this.getFluid(blockposition);

View File

@ -10,10 +10,10 @@ Optimize to check if the captured list even has values in it, and also to
just do a get call since the value can never be null. just do a get call since the value can never be null.
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a3fbdf5db5cd1f08e9920bbc786705f69f465efd..f797d737a374f222e94c132dea7fada5374b49e4 100644 index 98ea9bb98a1a447e1ab8a54839d263ee1cad58ff..7821d4cd05200ca32ba7e2c7cc7e9ff476d3a236 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -998,12 +998,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -999,12 +999,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return null; return null;
} else { } else {
// CraftBukkit start // CraftBukkit start

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add Heightmap API
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f797d737a374f222e94c132dea7fada5374b49e4..983bc1c7d9c0745b34fac8afc27ed8a275c0ad78 100644 index 7821d4cd05200ca32ba7e2c7cc7e9ff476d3a236..ee08cdcffc9237ee4154b7c756ba032b7723bd1f 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -573,8 +573,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -574,8 +574,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} }
} }

View File

@ -1392,7 +1392,7 @@ index 01bf28dc34dd69dbcee5f470cc71ec2fbb2fcc12..caa18b046cd4231b1caa9c70e766ab60
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 8cf3c10274b8320bf1938b95dd9f447deeb2c4d0..0bde1717431d770a9a73e83b56388d6f4923e404 100644 index 74709dff3f87e929f1583be524d4e53ad3be6728..7faaef50a5430c8bdf85ca0e37a4ad24ad56b1ef 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -2,6 +2,8 @@ package net.minecraft.server; @@ -2,6 +2,8 @@ package net.minecraft.server;
@ -1418,9 +1418,9 @@ index 8cf3c10274b8320bf1938b95dd9f447deeb2c4d0..0bde1717431d770a9a73e83b56388d6f
this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper
+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this.paperConfig) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray
this.generator = gen; this.generator = gen;
dimensionmanager.world = (WorldServer) this; // Paper
this.world = new CraftWorld((WorldServer) this, gen, env); this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit @@ -343,6 +347,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -342,6 +346,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit end // CraftBukkit end
IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag

View File

@ -8,7 +8,7 @@ ticket level 33 (yes getChunkIfLoaded will actually perform a chunk
load in that case). load in that case).
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 0a06ed36795afad00839174fc1a7e7f7b9e4a8c8..cf3e15e70ac22bbdd39153956cfdc6d2f8f44e2b 100644 index 9d001f816d0b8b6d6cf80ee6bce548f1017960b7..6ba6fd6157985ae9d7bb048c2d42b268d08697bc 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java --- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -996,7 +996,7 @@ public class PlayerConnection implements PacketListenerPlayIn { @@ -996,7 +996,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
@ -21,7 +21,7 @@ index 0a06ed36795afad00839174fc1a7e7f7b9e4a8c8..cf3e15e70ac22bbdd39153956cfdc6d2
return; return;
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0bde1717431d770a9a73e83b56388d6f4923e404..311685180fe720706dfb6c82b1b54f9876187b73 100644 index 7faaef50a5430c8bdf85ca0e37a4ad24ad56b1ef..21bb992cad2fd2692940ebe26360b8014c1df136 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -116,8 +116,16 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -116,8 +116,16 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@ -42,7 +42,7 @@ index 0bde1717431d770a9a73e83b56388d6f4923e404..311685180fe720706dfb6c82b1b54f98
protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { protected World(WorldData worlddata, DimensionManager dimensionmanager, BiFunction<World, WorldProvider, IChunkProvider> bifunction, GameProfilerFiller gameprofilerfiller, boolean flag, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) {
this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot
@@ -1109,14 +1117,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1110,14 +1118,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
} }
public boolean n(BlockPosition blockposition) { public boolean n(BlockPosition blockposition) {
@ -59,7 +59,7 @@ index 0bde1717431d770a9a73e83b56388d6f4923e404..311685180fe720706dfb6c82b1b54f98
return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity); return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity);
} }
@@ -1232,7 +1240,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1233,7 +1241,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 < j; ++i1) { for (int i1 = i; i1 < j; ++i1) {
for (int j1 = k; j1 < l; ++j1) { for (int j1 = k; j1 < l; ++j1) {

View File

@ -298,10 +298,10 @@ index a88e8598aab55ac769a5f186507f362e4f99cef4..21e444e6ad78081353a7330b60c74164
this.serverThreadQueue.awaitTasks(completablefuture::isDone); this.serverThreadQueue.awaitTasks(completablefuture::isDone);
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e682fda95 100644 index 21bb992cad2fd2692940ebe26360b8014c1df136..d46f09f684b0b49e84b86fab5f10ac83b4b64d0b 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1173,7 +1173,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1174,7 +1174,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 <= j; ++i1) { for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) { for (int j1 = k; j1 <= l; ++j1) {
@ -310,7 +310,7 @@ index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e
if (chunk != null) { if (chunk != null) {
chunk.a(entity, axisalignedbb, list, predicate); chunk.a(entity, axisalignedbb, list, predicate);
@@ -1194,7 +1194,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1195,7 +1195,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 < j; ++i1) { for (int i1 = i; i1 < j; ++i1) {
for (int j1 = k; j1 < l; ++j1) { for (int j1 = k; j1 < l; ++j1) {
@ -319,7 +319,7 @@ index 311685180fe720706dfb6c82b1b54f9876187b73..568e04faa314552e14286efdfcdfb79e
if (chunk != null) { if (chunk != null) {
chunk.a(entitytypes, axisalignedbb, list, predicate); chunk.a(entitytypes, axisalignedbb, list, predicate);
@@ -1217,7 +1217,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1218,7 +1218,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
for (int i1 = i; i1 < j; ++i1) { for (int i1 = i; i1 < j; ++i1) {
for (int j1 = k; j1 < l; ++j1) { for (int j1 = k; j1 < l; ++j1) {

View File

@ -481,10 +481,10 @@ index d4cbce3243fe1f4973c9c0ae0dbdab10e3390897..3b394c2726e0fbe595641a022e59c896
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 568e04faa314552e14286efdfcdfb79e682fda95..9e161746f2acbe544140979bddb51ac26ee0d20f 100644 index d46f09f684b0b49e84b86fab5f10ac83b4b64d0b..6b6612de65081895825858f52d0f1c6f23c8edb6 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1205,8 +1205,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1206,8 +1206,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return list; return list;
} }

View File

@ -94,10 +94,10 @@ index e8ce2ecf23e58d82febf6b9441e0004e69cdc858..acfe732af5b9f63fc2f6b78499defabe
public abstract StructureGenerator.a a(); public abstract StructureGenerator.a a();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 228e6e9ab997394dc99775a5f787455b8b7d6d63..f1d072a39cc2f0f7b214e7794f8dc5dcc282d6b3 100644 index 3742be65afebcf4c61a9efbd1c207f968e5f7473..b9685abed74fd1fb239b0940751fde65cceb6f57 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1569,8 +1569,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1570,8 +1570,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return this.methodProfiler; return this.methodProfiler;
} }

View File

@ -65,10 +65,10 @@ index 927abc78e973e6f0f87e12303409fd808b3cf6ab..6688b1340e2cc8fb13a7e80c9b7c37b8
} }
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index f1d072a39cc2f0f7b214e7794f8dc5dcc282d6b3..0c23fc89d7ad980aa8b094784e88e2d91fb4f07b 100644 index b9685abed74fd1fb239b0940751fde65cceb6f57..d8eb8a59da36215334582ae73822e1fd4a5b2df1 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -265,6 +265,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -266,6 +266,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@Override @Override
public Chunk getChunkAt(int i, int j) { public Chunk getChunkAt(int i, int j) {

View File

@ -338,10 +338,10 @@ index 321eae23c575528788b1b575f17593580d6ba737..b19bbbbc81376177751396a2de9452ce
public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER public final SoundEffectType getStepSound() { return this.r(); } // Paper - OBFHELPER
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0c23fc89d7ad980aa8b094784e88e2d91fb4f07b..de9f49b884838105c537b73d69234eb26fddb708 100644 index d8eb8a59da36215334582ae73822e1fd4a5b2df1..ac8b21e69b198612427a81a16fc1a3ff0b0cb558 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1563,10 +1563,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1564,10 +1564,19 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public abstract TagRegistry t(); public abstract TagRegistry t();
public BlockPosition a(int i, int j, int k, int l) { public BlockPosition a(int i, int j, int k, int l) {
@ -363,7 +363,7 @@ index 0c23fc89d7ad980aa8b094784e88e2d91fb4f07b..de9f49b884838105c537b73d69234eb2
public boolean isSavingDisabled() { public boolean isSavingDisabled() {
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 0d6abbab237916df4f7d7d79f2f4725018d8edf9..cb2ae8eff36f46b6963ee45d7740ac48afac1ab0 100644 index 1f28e24f4f056c1f72293a3004c6dbdb8f8d1f9e..5519fb529dd8e1f93aab79dbc434715e08edb94f 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java --- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -531,7 +531,12 @@ public class WorldServer extends World { @@ -531,7 +531,12 @@ public class WorldServer extends World {

View File

@ -236,10 +236,10 @@ index 47dbcb70a6b41438a5bf3196495cfdaf02bd2b74..0d12c3657304ccf7ab25a2614c380ee7
SystemUtils.c.shutdown(); SystemUtils.c.shutdown();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index de9f49b884838105c537b73d69234eb26fddb708..c8619af2cf43041e3eebec74e24c7f127a662efe 100644 index ac8b21e69b198612427a81a16fc1a3ff0b0cb558..42be4edb36200626913fa99b1e67956933022531 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -792,6 +792,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -793,6 +793,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
gameprofilerfiller.exit(); gameprofilerfiller.exit();
} catch (Throwable throwable) { } catch (Throwable throwable) {
@ -247,7 +247,7 @@ index de9f49b884838105c537b73d69234eb26fddb708..c8619af2cf43041e3eebec74e24c7f12
// Paper start - Prevent tile entity and entity crashes // Paper start - Prevent tile entity and entity crashes
String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ();
System.err.println(msg); System.err.println(msg);
@@ -867,6 +868,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -868,6 +869,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
try { try {
consumer.accept(entity); consumer.accept(entity);
} catch (Throwable throwable) { } catch (Throwable throwable) {

View File

@ -178,10 +178,10 @@ index 4157e50e4d99c029759bffcb48a8d645487554c8..5135308fb6137a34ed6fd061f0a210de
return stream.filter(axisalignedbb1::c).map(VoxelShapes::a); return stream.filter(axisalignedbb1::c).map(VoxelShapes::a);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c8619af2cf43041e3eebec74e24c7f127a662efe..899c535c4056cd2375ab8f834f03267d405f4bda 100644 index 42be4edb36200626913fa99b1e67956933022531..4dc03c27bba5cd2dd1d6cb2e82087ef834f41d81 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -1178,6 +1178,32 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -1179,6 +1179,32 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return this.getChunkAt(i, j, ChunkStatus.FULL, false); return this.getChunkAt(i, j, ChunkStatus.FULL, false);
} }

View File

@ -570,10 +570,10 @@ index 60af90bf8c376ab8ab61b16ae38886149faa88cc..9b726de6daeba42120f3a948fbdcf080
while (iterator.hasNext()) { while (iterator.hasNext()) {
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 899c535c4056cd2375ab8f834f03267d405f4bda..0e6368d0fb3beccb492ae3867fb4e22825f928a2 100644 index 4dc03c27bba5cd2dd1d6cb2e82087ef834f41d81..e82b8b9a4dbc9a595df7d8e56596a93fde7b687a 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -443,8 +443,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -444,8 +444,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
this.b(blockposition, iblockdata1, iblockdata2); this.b(blockposition, iblockdata1, iblockdata2);
} }

View File

@ -101,10 +101,10 @@ index b19bbbbc81376177751396a2de9452ce1f84c06b..296b41bf36ee1ace5bd9db2b810bf926
public Material getMaterial() { public Material getMaterial() {
return this.getBlock().k(this); return this.getBlock().k(this);
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 0e6368d0fb3beccb492ae3867fb4e22825f928a2..508a3ed1ed041c21f5ec1fd18dfb01311e5310bf 100644 index e82b8b9a4dbc9a595df7d8e56596a93fde7b687a..561b42472261a973fea6344d76ca7ea1993aee27 100644
--- a/src/main/java/net/minecraft/server/World.java --- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java
@@ -341,6 +341,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { @@ -342,6 +342,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
// CraftBukkit start - tree generation // CraftBukkit start - tree generation
if (this.captureTreeGeneration) { if (this.captureTreeGeneration) {

View File

@ -11,10 +11,10 @@ This will drastically cut down on packet sending cost for worlds with
lots of players in them. lots of players in them.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index 9b726de6daeba42120f3a948fbdcf080d0e72917..cc5d75049d3553e0b01068e4e0c5677fe81f8387 100644 index 9b726de6daeba42120f3a948fbdcf080d0e72917..269580ae2a6edca979ccc1e46df144468ea70a18 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java --- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -1027,11 +1027,22 @@ public abstract class PlayerList { @@ -1027,11 +1027,27 @@ public abstract class PlayerList {
world = (WorldServer) entityhuman.world; world = (WorldServer) entityhuman.world;
} }
@ -31,7 +31,12 @@ index 9b726de6daeba42120f3a948fbdcf080d0e72917..cc5d75049d3553e0b01068e4e0c5677f
+ LOGGER.error("Sending packet to invalid world" + entityhuman + " " + dimensionmanager + " - " + packet.getClass().getName(), new Throwable()); + LOGGER.error("Sending packet to invalid world" + entityhuman + " " + dimensionmanager + " - " + packet.getClass().getName(), new Throwable());
+ return; // ??? shouldn't happen... + return; // ??? shouldn't happen...
+ } + }
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> nearbyPlayers = world.getChunkProvider().playerChunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(MCUtil.fastFloor(d0) >> 4, MCUtil.fastFloor(d2) >> 4); + ChunkProviderServer chunkProvider = (ChunkProviderServer) world.chunkProvider;
+ if (chunkProvider == null) {
+ // ??? Shouldn't be possible but seem some hacky plugins apparently do hack things.
+ return;
+ }
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> nearbyPlayers = chunkProvider.playerChunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(MCUtil.fastFloor(d0) >> 4, MCUtil.fastFloor(d2) >> 4);
+ if (nearbyPlayers == null) { + if (nearbyPlayers == null) {
+ return; + return;
+ } + }