Skip to content

Commit

Permalink
completion of showfake persistence: improve survival compat
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Oct 23, 2019
1 parent 0c82f14 commit 52ee550
Showing 1 changed file with 10 additions and 0 deletions.
Expand Up @@ -103,6 +103,8 @@ public void setPacketListener(PacketListener packetlistener) {
public static Field INFOARRAY_MULTIBLOCKCHANGE = ReflectionHelper.getFields(PacketPlayOutMultiBlockChange.class).get("b");
public static Field CHUNKX_MAPCHUNK = ReflectionHelper.getFields(PacketPlayOutMapChunk.class).get("a");
public static Field CHUNKZ_MAPCHUNK = ReflectionHelper.getFields(PacketPlayOutMapChunk.class).get("b");
public static Field BLOCKPOS_BLOCKBREAK = ReflectionHelper.getFields(PacketPlayOutBlockBreak.class).get("c");
public static Field BLOCKDATA_BLOCKBREAK = ReflectionHelper.getFields(PacketPlayOutBlockBreak.class).get("d");

public static Object duplo(Object a) {
try {
Expand Down Expand Up @@ -402,6 +404,14 @@ else if (packet instanceof PacketPlayOutBlockChange) {
((PacketPlayOutBlockChange) packet).block = FakeBlockHelper.getNMSState(block);
}
}
else if (packet instanceof PacketPlayOutBlockBreak) {
BlockPosition pos = (BlockPosition) BLOCKPOS_BLOCKBREAK.get(packet);
LocationTag loc = new LocationTag(player.getWorld().getWorld(), pos.getX(), pos.getY(), pos.getZ());
FakeBlock block = FakeBlock.getFakeBlockFor(player.getUniqueID(), loc);
if (block != null) {
BLOCKDATA_BLOCKBREAK.set(packet, FakeBlockHelper.getNMSState(block));
}
}
}
catch (Exception ex) {
Debug.echoError(ex);
Expand Down

0 comments on commit 52ee550

Please sign in to comment.