Skip to content

Commit

Permalink
Fix #321 - Item data parsing error
Browse files Browse the repository at this point in the history
  • Loading branch information
lt-name committed Oct 4, 2024
1 parent 4ded011 commit 2de5bda
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/main/java/cn/nukkit/utils/BinaryStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -719,10 +719,13 @@ private Item getSlotNew(int protocolId) {
}

int blockRuntimeId = this.getVarInt();// blockRuntimeId
if (id != null && id < 256 && id != 166) { // ItemBlock
int fullId = GlobalBlockPalette.getLegacyFullId(protocolId, blockRuntimeId);
if (fullId != -1) {
damage = fullId & Block.DATA_MASK;
//TODO 在1.21.30会得到错误数据
if (protocolId < ProtocolInfo.v1_21_30) {
if (id != null && id < 256 && id != 166) { // ItemBlock
int fullId = GlobalBlockPalette.getLegacyFullId(protocolId, blockRuntimeId);
if (fullId != -1) {
damage = fullId & Block.DATA_MASK;
}
}
}

Expand Down

0 comments on commit 2de5bda

Please sign in to comment.