mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-01 03:17:30 -05:00
Fix certain NBT read/writes that should be nameless
This commit is contained in:
parent
fa846a7726
commit
8dfcd35fed
5 changed files with 9 additions and 9 deletions
|
@ -287,7 +287,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
|||
}
|
||||
|
||||
int item = this.readVarInt(buf);
|
||||
return new ItemStack(item, buf.readByte(), this.readTag(buf));
|
||||
return new ItemStack(item, buf.readByte(), this.readAnyTag(buf));
|
||||
}
|
||||
|
||||
public void writeItemStack(ByteBuf buf, ItemStack item) throws IOException {
|
||||
|
@ -295,7 +295,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
|||
if (item != null) {
|
||||
this.writeVarInt(buf, item.getId());
|
||||
buf.writeByte(item.getAmount());
|
||||
this.writeTag(buf, item.getNbt());
|
||||
this.writeAnyTag(buf, item.getNbt());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ public class MetadataType<T> {
|
|||
public static final MetadataType<Optional<UUID>> OPTIONAL_UUID = new MetadataType<>(optionalReader(MinecraftCodecHelper::readUUID), optionalWriter(MinecraftCodecHelper::writeUUID), ObjectEntityMetadata::new);
|
||||
public static final IntMetadataType BLOCK_STATE = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
|
||||
public static final IntMetadataType OPTIONAL_BLOCK_STATE = new IntMetadataType(MinecraftCodecHelper::readVarInt, MinecraftCodecHelper::writeVarInt, IntEntityMetadata::new);
|
||||
public static final MetadataType<CompoundTag> NBT_TAG = new MetadataType<>(MinecraftCodecHelper::readTag, MinecraftCodecHelper::writeTag, ObjectEntityMetadata::new);
|
||||
public static final MetadataType<CompoundTag> NBT_TAG = new MetadataType<>(MinecraftCodecHelper::readAnyTag, MinecraftCodecHelper::writeAnyTag, ObjectEntityMetadata::new);
|
||||
public static final MetadataType<Particle> PARTICLE = new MetadataType<>(MinecraftCodecHelper::readParticle, MinecraftCodecHelper::writeParticle, ObjectEntityMetadata::new);
|
||||
public static final MetadataType<VillagerData> VILLAGER_DATA = new MetadataType<>(MinecraftCodecHelper::readVillagerData, MinecraftCodecHelper::writeVillagerData, ObjectEntityMetadata::new);
|
||||
public static final OptionalIntMetadataType OPTIONAL_VARINT = new OptionalIntMetadataType(ObjectEntityMetadata::new);
|
||||
|
|
|
@ -25,13 +25,13 @@ public class ClientboundBlockEntityDataPacket implements MinecraftPacket {
|
|||
public ClientboundBlockEntityDataPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
|
||||
this.position = helper.readPosition(in);
|
||||
this.type = helper.readBlockEntityType(in);
|
||||
this.nbt = helper.readTag(in);
|
||||
this.nbt = helper.readAnyTag(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
|
||||
helper.writePosition(out, this.position);
|
||||
helper.writeBlockEntityType(out, this.type);
|
||||
helper.writeTag(out, this.nbt);
|
||||
helper.writeAnyTag(out, this.nbt);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ClientboundLevelChunkWithLightPacket implements MinecraftPacket {
|
|||
int blockEntityZ = xz & 15;
|
||||
int blockEntityY = in.readShort();
|
||||
BlockEntityType type = helper.readBlockEntityType(in);
|
||||
CompoundTag tag = helper.readTag(in);
|
||||
CompoundTag tag = helper.readAnyTag(in);
|
||||
this.blockEntities[i] = new BlockEntityInfo(blockEntityX, blockEntityY, blockEntityZ, type, tag);
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class ClientboundLevelChunkWithLightPacket implements MinecraftPacket {
|
|||
out.writeByte(((blockEntity.getX() & 15) << 4) | blockEntity.getZ() & 15);
|
||||
out.writeShort(blockEntity.getY());
|
||||
helper.writeBlockEntityType(out, blockEntity.getType());
|
||||
helper.writeTag(out, blockEntity.getNbt());
|
||||
helper.writeAnyTag(out, blockEntity.getNbt());
|
||||
}
|
||||
|
||||
helper.writeLightUpdateData(out, this.lightData);
|
||||
|
|
|
@ -20,12 +20,12 @@ public class ClientboundTagQueryPacket implements MinecraftPacket {
|
|||
|
||||
public ClientboundTagQueryPacket(ByteBuf in, MinecraftCodecHelper helper) throws IOException {
|
||||
this.transactionId = helper.readVarInt(in);
|
||||
this.nbt = helper.readTag(in);
|
||||
this.nbt = helper.readAnyTag(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) throws IOException {
|
||||
helper.writeVarInt(out, this.transactionId);
|
||||
helper.writeTag(out, this.nbt);
|
||||
helper.writeAnyTag(out, this.nbt);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue