2018-09-23 03:03:53 +00:00
|
|
|
From 36468491f2d0e76cf1f2f911d3fd57bb1d8fb0e1 Mon Sep 17 00:00:00 2001
|
2018-09-20 23:13:29 +00:00
|
|
|
From: Aikar <aikar@aikar.co>
|
|
|
|
Date: Thu, 20 Sep 2018 19:11:33 -0400
|
|
|
|
Subject: [PATCH] MC-134115: Fix Double Chest Conversion Error
|
|
|
|
|
|
|
|
A bug with double chest conversion would lead to data
|
|
|
|
loss from chunks if they crossed chunk boundries.
|
|
|
|
|
|
|
|
This fixes the issue.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
Improve Light Queue and force enable it for all
There is no reason for the light queue to even be an option. This
enables the light queue for everyone.
This also improves the "can we still tick" time logic to always
check before running a light operation.
previously, we always executed at least 10 on the first world
(but not other worlds...), but we are seeing light take up some
heavy time, so improving that for now.
I've now also improved recheck gaps logic to happen at the end of all single block updates
This also prevents multiple gap checks, as previously if a tick skipped
the gaps check, the next tick would end up re-adding the entry again,
resulting in multiple gap checks.
This now just sets a marker "We need to recheck gaps" and will only occur
once.
This also should reduce chunk loads, as previously, we checked if
the neighbor chunks were loaded for the gap check, however those
neighbor chunks might of unloaded before the light queue operation
actually ran. Now, the neighbor chunk is done when the gap check
is being done, so it should avoid loading chunks.
Fixes #1466
Fixes #1431
2018-09-22 15:46:31 +00:00
|
|
|
index 4f72b1b184..1c4e892aad 100644
|
2018-09-20 23:13:29 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Chunk.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
Improve Light Queue and force enable it for all
There is no reason for the light queue to even be an option. This
enables the light queue for everyone.
This also improves the "can we still tick" time logic to always
check before running a light operation.
previously, we always executed at least 10 on the first world
(but not other worlds...), but we are seeing light take up some
heavy time, so improving that for now.
I've now also improved recheck gaps logic to happen at the end of all single block updates
This also prevents multiple gap checks, as previously if a tick skipped
the gaps check, the next tick would end up re-adding the entry again,
resulting in multiple gap checks.
This now just sets a marker "We need to recheck gaps" and will only occur
once.
This also should reduce chunk loads, as previously, we checked if
the neighbor chunks were loaded for the gap check, however those
neighbor chunks might of unloaded before the light queue operation
actually ran. Now, the neighbor chunk is done when the gap check
is being done, so it should avoid loading chunks.
Fixes #1466
Fixes #1431
2018-09-22 15:46:31 +00:00
|
|
|
@@ -515,6 +515,26 @@ public class Chunk implements IChunkAccess {
|
2018-09-20 23:13:29 +00:00
|
|
|
return this.a(blockposition, iblockdata, flag, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // Paper start
|
|
|
|
+ public void setTypeDirect(BlockPosition blockposition, IBlockData iblockdata) {
|
|
|
|
+ int i = blockposition.getX() & 15;
|
|
|
|
+ int j = blockposition.getY();
|
|
|
|
+ int k = blockposition.getZ() & 15;
|
|
|
|
+ ChunkSection section = this.sections[j >> 4];
|
|
|
|
+
|
|
|
|
+ if (section == Chunk.EMPTY_CHUNK_SECTION) {
|
|
|
|
+ if (iblockdata.isAir()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ section = new ChunkSection(j >> 4 << 4, this.world.worldProvider.g(), this, this.world, true); // Paper - Anti-Xray
|
|
|
|
+ this.sections[j >> 4] = section;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ section.setType(i, j & 15, k, iblockdata);
|
|
|
|
+ }
|
|
|
|
+ // Paper end
|
|
|
|
+
|
|
|
|
@Nullable
|
|
|
|
public IBlockData a(BlockPosition blockposition, IBlockData iblockdata, boolean flag, boolean doPlace) {
|
|
|
|
// CraftBukkit end
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkConverter.java b/src/main/java/net/minecraft/server/ChunkConverter.java
|
|
|
|
index 65b2654de8..70c60d54e7 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/ChunkConverter.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ChunkConverter.java
|
|
|
|
@@ -198,10 +198,15 @@ public class ChunkConverter {
|
|
|
|
EnumDirection enumdirection1 = (EnumDirection)iblockdata.get(BlockChest.FACING);
|
|
|
|
if (enumdirection.k() != enumdirection1.k() && enumdirection1 == iblockdata1.get(BlockChest.FACING)) {
|
|
|
|
BlockPropertyChestType blockpropertychesttype = enumdirection == enumdirection1.e() ? BlockPropertyChestType.LEFT : BlockPropertyChestType.RIGHT;
|
|
|
|
- generatoraccess.setTypeAndData(blockposition1, (IBlockData)iblockdata1.set(BlockChest.b, blockpropertychesttype.a()), 18);
|
|
|
|
+ // Paper start
|
|
|
|
+ Chunk chunk = ((World) generatoraccess.getMinecraftWorld()).getChunkAtWorldCoords(blockposition);
|
|
|
|
+ Chunk chunk1 = ((World) generatoraccess.getMinecraftWorld()).getChunkAtWorldCoords(blockposition1);
|
|
|
|
+ chunk1.setTypeDirect(blockposition1, (IBlockData)iblockdata1.set(BlockChest.b, blockpropertychesttype.a()));
|
|
|
|
+
|
|
|
|
if (enumdirection1 == EnumDirection.NORTH || enumdirection1 == EnumDirection.EAST) {
|
|
|
|
- TileEntity tileentity = generatoraccess.getTileEntity(blockposition);
|
|
|
|
- TileEntity tileentity1 = generatoraccess.getTileEntity(blockposition1);
|
|
|
|
+ TileEntity tileentity = chunk.getTileEntity(blockposition);
|
|
|
|
+ TileEntity tileentity1 = chunk1.getTileEntity(blockposition1);
|
|
|
|
+ // Paper end
|
|
|
|
if (tileentity instanceof TileEntityChest && tileentity1 instanceof TileEntityChest) {
|
|
|
|
TileEntityChest.a((TileEntityChest)tileentity, (TileEntityChest)tileentity1);
|
|
|
|
}
|
|
|
|
--
|
|
|
|
2.19.0
|
|
|
|
|