Skip to content

Commit

Permalink
Fixed 1.2.5 -> 1.3 PRE_CHUNK translation
Browse files Browse the repository at this point in the history
  • Loading branch information
RaphiMC committed Sep 20, 2024
1 parent 883f408 commit 4dc2b7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void register() {
public void register() {
map(Types.INT); // chunkX
map(Types.INT); // chunkZ
map(Types.UNSIGNED_BYTE); // mode
map(Types.BOOLEAN); // mode
handler(wrapper -> wrapper.user().get(InventoryStorage.class).unload(wrapper.get(Types.INT, 0), wrapper.get(Types.INT, 1)));
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,17 +426,17 @@ public void register() {
this.registerClientbound(ClientboundPackets1_2_4.PRE_CHUNK, ClientboundPackets1_3_1.LEVEL_CHUNK, wrapper -> {
final int chunkX = wrapper.read(Types.INT); // x
final int chunkZ = wrapper.read(Types.INT); // z
final short mode = wrapper.read(Types.UNSIGNED_BYTE); // mode
final boolean load = mode != 0;
final boolean load = wrapper.read(Types.BOOLEAN); // mode

wrapper.user().get(ChestStateTracker.class).unload(chunkX, chunkZ);

if (!load) {
final Chunk chunk = new BaseChunk(chunkX, chunkZ, true, false, 0, new ChunkSection[16], null, new ArrayList<>());
wrapper.write(Types1_7_6.getChunk(wrapper.user().getClientWorld(Protocolr1_2_4_5Tor1_3_1_2.class).getEnvironment()), chunk);
final Chunk chunk;
if (load) {
chunk = ChunkUtil.createEmptyChunk(chunkX, chunkZ);
} else {
wrapper.cancel();
chunk = new BaseChunk(chunkX, chunkZ, true, false, 0, new ChunkSection[16], null, new ArrayList<>());
}
wrapper.write(Types1_7_6.getChunk(wrapper.user().getClientWorld(Protocolr1_2_4_5Tor1_3_1_2.class).getEnvironment()), chunk);
});
this.registerClientbound(ClientboundPackets1_2_4.LEVEL_CHUNK, wrapper -> {
final Environment dimension = wrapper.user().getClientWorld(Protocolr1_2_4_5Tor1_3_1_2.class).getEnvironment();
Expand Down

0 comments on commit 4dc2b7c

Please sign in to comment.