Fix item frames on 1.17.30

This commit is contained in:
Camotoy 2021-09-21 16:50:06 -04:00
parent e0ae4c1b85
commit d5c37e927b
No known key found for this signature in database
GPG key ID: 7EEFB66FE798081F

View file

@ -35,6 +35,7 @@ import com.nukkitx.nbt.NbtMapBuilder;
import com.nukkitx.protocol.bedrock.data.inventory.ItemData; import com.nukkitx.protocol.bedrock.data.inventory.ItemData;
import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket; import com.nukkitx.protocol.bedrock.packet.BlockEntityDataPacket;
import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket; import com.nukkitx.protocol.bedrock.packet.UpdateBlockPacket;
import com.nukkitx.protocol.bedrock.v448.Bedrock_v465;
import lombok.Getter; import lombok.Getter;
import org.geysermc.connector.entity.type.EntityType; import org.geysermc.connector.entity.type.EntityType;
import org.geysermc.connector.network.session.GeyserSession; import org.geysermc.connector.network.session.GeyserSession;
@ -85,10 +86,14 @@ public class ItemFrameEntity extends Entity {
NbtMapBuilder blockBuilder = NbtMap.builder() NbtMapBuilder blockBuilder = NbtMap.builder()
.putString("name", this.entityType == EntityType.GLOW_ITEM_FRAME ? "minecraft:glow_frame" : "minecraft:frame") .putString("name", this.entityType == EntityType.GLOW_ITEM_FRAME ? "minecraft:glow_frame" : "minecraft:frame")
.putInt("version", session.getBlockMappings().getBlockStateVersion()); .putInt("version", session.getBlockMappings().getBlockStateVersion());
blockBuilder.put("states", NbtMap.builder() NbtMapBuilder statesBuilder = NbtMap.builder()
.putInt("facing_direction", direction.ordinal()) .putInt("facing_direction", direction.ordinal())
.putByte("item_frame_map_bit", (byte) 0) .putByte("item_frame_map_bit", (byte) 0);
.build()); if (session.getUpstream().getProtocolVersion() >= Bedrock_v465.V465_CODEC.getProtocolVersion()) {
statesBuilder.putByte("item_frame_photo_bit", (byte) 0);
}
blockBuilder.put("states", statesBuilder.build());
bedrockRuntimeId = session.getBlockMappings().getItemFrame(blockBuilder.build()); bedrockRuntimeId = session.getBlockMappings().getItemFrame(blockBuilder.build());
bedrockPosition = Vector3i.from(position.getFloorX(), position.getFloorY(), position.getFloorZ()); bedrockPosition = Vector3i.from(position.getFloorX(), position.getFloorY(), position.getFloorZ());