Fix certain NBT read/writes that should be nameless

This commit is contained in:
Konicai 2023-09-09 00:34:57 -04:00
parent fa846a7726
commit 8dfcd35fed
No known key found for this signature in database
GPG key ID: 710D09287708C823
5 changed files with 9 additions and 9 deletions

View file

@ -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());
}
}

View file

@ -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);

View file

@ -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);
}
}

View file

@ -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);

View file

@ -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);
}
}