mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-28 19:22:50 +01:00
MC-134115: Fix Double Chest Chunk Conversion Error
A bug with double chest conversion would lead to data loss from chunks if they crossed chunk boundries. This fixes the issue. It should now be safe to upgrade worlds to 1.13.1
This commit is contained in:
parent
1b8f425949
commit
fba19f5f30
1 changed files with 67 additions and 0 deletions
|
@ -0,0 +1,67 @@
|
|||
From fca711e6d936513f9b0955d273a9969e5b351190 Mon Sep 17 00:00:00 2001
|
||||
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
|
||||
index 33f5aa721f..ca5cd62866 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -521,6 +521,26 @@ public class Chunk implements IChunkAccess {
|
||||
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
|
||||
|
Loading…
Reference in a new issue