Skip to content

Commit

Permalink
add (experimental) showfake chunk-breakage preventer
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jan 28, 2021
1 parent 779ee76 commit d97a2fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Expand Up @@ -56,6 +56,8 @@ public ShowFakeCommand() {
// You can enable the player to walk through fake air via <@link mechanism PlayerTag.noclip>.
// Note as well that some clientside block effects may occur (eg fake fire may appear momentarily to actually ignite things, but won't actually damage them).
//
// Warning: extremely complex chunks (those with a significant variety of block types in a small area) might not be able to retain fake blocks over time properly.
//
// @Tags
// <PlayerTag.fake_block_locations>
// <PlayerTag.fake_block[<location>]>
Expand Down
Expand Up @@ -112,6 +112,12 @@ public static PacketPlayOutMapChunk handleMapChunkPacket(PacketPlayOutMapChunk o
outputSerial.a(blockListHelper); // writeLongs
continue;
}
char dataBitsF = (char)(64 / width);
int expectedLength = (4096 + dataBitsF - 1) / dataBitsF;
if (blockListHelper.length != expectedLength) {
return originalPacket; // This chunk is too-complex and is using non-standard chunk format. For now, just ignore it.
// TODO: Add support for processing very-complex chunks (DataPaletteHash might be responsible for the unique format?)
}
DataBits bits = new DataBits(width, 4096, blockListHelper);
int minY = y << 4;
int maxY = (y << 4) + 16;
Expand Down

0 comments on commit d97a2fe

Please sign in to comment.