-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocol #390
Conversation
Lots of packet changes, not yet usable. https://wiki.vg/Pre-release_protocol#Chunk_Data has a new format:
|
1.16.3 (753) is now out, but according to https://wiki.vg/index.php?title=Pre-release_protocol&action=history, "1.16.3, no changes other than PVN" = protocol version number is the only change. Add both, using same class. |
Is this going to be worked on further? Would like to test out stevenarella on my 1.16.3 server. |
1.16.4 (754) is out now, falling behind. References: https://wiki.vg/Protocol#Chunk_Data
diff -ur 1.15/ChunkColumn.js 1.16/ChunkColumn.js
--- 1.15/ChunkColumn.js 2020-11-22 10:25:27.000000000 -0800
+++ 1.16/ChunkColumn.js 2020-11-22 10:25:27.000000000 -0800
@@ -2,8 +2,7 @@
const ChunkSection = require('./ChunkSection')
const constants = require('../common/constants')
const varInt = require('../common/varInt')
-
-const BitArray = require('../common/BitArray')
+const BitArray = require('../common/BitArrayNoSpan')
// wrap with func to provide version specific Block
module.exports = (Block, mcData) => {
diff -ur 1.15/ChunkSection.js 1.16/ChunkSection.js
--- 1.15/ChunkSection.js 2020-11-22 10:25:27.000000000 -0800
+++ 1.16/ChunkSection.js 2020-11-22 10:25:27.000000000 -0800
@@ -1,4 +1,4 @@
-const BitArray = require('../common/BitArray')
+const BitArray = require('../common/BitArrayNoSpan')
const neededBits = require('../common/neededBits')
const constants = require('../common/constants')
const varInt = require('../common/varInt') only change is BitArray to BitArrayNoSpan https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/common/BitArrayNoSpan.js |
https://wiki.vg/Pre-release_protocol#Chunk_Data This line in src/world/mod.rs load_chunk19_or_115: let m = bit::Map::from_raw(bits, bit_size as usize); mapped in https://github.com/iceiix/stevenarella/blob/master/protocol/src/types/bit/map.rs - this is what allows the spanning. Would need a modified bit map type to not span longs (compare https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/common/BitArrayNoSpan.js vs https://github.com/PrismarineJS/prismarine-chunk/blob/master/src/pc/common/BitArray.js) |
Prototyping tweaking the algorithm based on the example data at https://wiki.vg/Protocol#Chunk_Data. Porting the old bit slicing code: # https://wiki.vg/Protocol#Chunk_Data
bits=[0x0020863148418841, 0x01018A7260F68C87]
class S(object):
def __init__(self):
self.bit_size = 5
self.bits = bits
def get(i):
self = S()
i = i * self.bit_size;
pos = i / 64;
mask = (1 << self.bit_size) - 1;
ii = i % 64;
pos2 = (i + self.bit_size - 1) / 64;
if pos2 == pos:
return ((self.bits[pos] >> ii) & mask)
else:
used = 64 - ii;
return (((self.bits[pos] >> ii) | (self.bits[pos2] << used)) & mask)
def seps(e, size):
e = list(e)
for i in range(len(e))[::-size][1:]:
e.insert(i+1," ")
result = "".join(e)
return result
print seps("{0:064b}".format(bits[0]), 5)
print seps("{0:064b}".format(bits[1]), 5)
for i in range(0,25):
print i, "=", "{0:05b}".format(get(i)), "=", get(i) It should be: 122344566480743131516914101202, but after i=12 crosses the long, causing the difference in this behavior. Here's how another project https://github.com/adepierre/Botcraft/blob/6b25c8b90f3a129265a370723a556f2944248dcf/botcraft/src/Game/World/Chunk.cpp handled the difference: #if PROTOCOL_VERSION > 712
// From protocol version 713, the compacted array format has been adjusted so that
//individual entries no longer span across multiple longs
if (64 - (bit_offset % 64) < bits_per_block)
{
bit_offset += 64 - (bit_offset % 64);
}
int start_long_index = bit_offset / 64;
int end_long_index = start_long_index;
int start_offset = bit_offset % 64;
bit_offset += bits_per_block;
#else
int block_index = (((block_y * SECTION_HEIGHT) + block_z) * CHUNK_WIDTH) + block_x;
int start_long_index = (block_index * bits_per_block) / 64;
int start_offset = (block_index * bits_per_block) % 64;
int end_long_index = ((block_index + 1) * bits_per_block - 1) / 64;
#endif but they are calculating a running offset, |
Tweaking the prototype, adding compensation for padding: 4 bits for every 64, gets the correct results:
output:
now to implement and test |
Added support for the new chunk format, logging in no longer crashes, but the world does not render (there may be other missing changes or bugs). |
Tested with 1.16.4, 16.16.3, 1.16.2, able to connect |
Adds support for 1.16.4 (754) / 1.16.3 (753) / 1.16.2 (751) protocols * Update packet IDs and readme * Add and handle ChunkData_Biomes3D_VarInt variant * Support world chunk data padded bit map array * Add and handle JoinGame_WorldNames_IsHard variant * Add and handle MultiBlockChange_Packed variant * Add UnlockRecipes_WithBlastSmoker variant * Add SetDisplayedRecipe and SetRecipeBookState packets
https://minecraft.gamepedia.com/Java_Edition_1.16.2
1.16.4 (754): https://wiki.vg/Protocol — diff 1.16.4 from 1.16.3: https://wiki.vg/index.php?title=Protocol&type=revision&diff=16144&oldid=16091 (no significant changes?)
1.16.3 (753): https://wiki.vg/index.php?title=Protocol&oldid=16091 (version number change only)
1.16.2 (751): https://wiki.vg/index.php?title=Pre-release_protocol&oldid=16001
1.16.1 (736): https://wiki.vg/index.php?title=Pre-release_protocol&oldid=15895
diff 1.16.2 from 1.16.1: https://wiki.vg/index.php?title=Pre-release_protocol&type=revision&diff=16001&oldid=15895