mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Limit blockitem metadata hack to just blockitems
for some reason putting NBT on some items makes the creative inventory go haywire. Sadly, we currently need this hack, so I limit it to only stuff which actually needs it (blockitems). closes #4159
This commit is contained in:
parent
b94bbf6f5e
commit
3c8eb29d4e
@ -310,8 +310,15 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
|
||||
$writeExtraCrapInTheMiddle($this);
|
||||
|
||||
$block = $item->getBlock();
|
||||
$this->putVarInt($block->getId() === BlockIds::AIR ? 0 : RuntimeBlockMapping::toStaticRuntimeId($block->getId(), $block->getDamage()));
|
||||
$blockRuntimeId = 0;
|
||||
$isBlockItem = $item->getId() < 256;
|
||||
if($isBlockItem){
|
||||
$block = $item->getBlock();
|
||||
if($block->getId() !== BlockIds::AIR){
|
||||
$blockRuntimeId = RuntimeBlockMapping::toStaticRuntimeId($block->getId(), $block->getDamage());
|
||||
}
|
||||
}
|
||||
$this->putVarInt($blockRuntimeId);
|
||||
|
||||
$nbt = null;
|
||||
if($item->hasCompoundTag()){
|
||||
@ -328,7 +335,7 @@ class NetworkBinaryStream extends BinaryStream{
|
||||
$nbt = new CompoundTag();
|
||||
}
|
||||
$nbt->setInt(self::DAMAGE_TAG, $coreData);
|
||||
}elseif($block->getId() !== BlockIds::AIR && $coreData !== 0){
|
||||
}elseif($isBlockItem && $coreData !== 0){
|
||||
//TODO HACK: This foul-smelling code ensures that we can correctly deserialize an item when the
|
||||
//client sends it back to us, because as of 1.16.220, blockitems quietly discard their metadata
|
||||
//client-side. Aside from being very annoying, this also breaks various server-side behaviours.
|
||||
|
Loading…
x
Reference in New Issue
Block a user