Replace DataItem constructor usages (#3893)

This commit is contained in:
EnZaXD 2024-05-30 10:42:55 +02:00 committed by GitHub
parent 03e8eec12e
commit 5245a7ef2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View File

@ -320,11 +320,11 @@ public class EntityPacketRewriter1_14 extends EntityRewriter<ClientboundPackets1
int armorType = meta.value();
Item armorItem = null;
if (armorType == 1) { //iron armor
armorItem = new DataItem(protocol.getMappingData().getNewItemId(727), (byte) 1, (short) 0, null);
armorItem = new DataItem(protocol.getMappingData().getNewItemId(727), (byte) 1, null);
} else if (armorType == 2) { //gold armor
armorItem = new DataItem(protocol.getMappingData().getNewItemId(728), (byte) 1, (short) 0, null);
armorItem = new DataItem(protocol.getMappingData().getNewItemId(728), (byte) 1, null);
} else if (armorType == 3) { //diamond armor
armorItem = new DataItem(protocol.getMappingData().getNewItemId(729), (byte) 1, (short) 0, null);
armorItem = new DataItem(protocol.getMappingData().getNewItemId(729), (byte) 1, null);
}
PacketWrapper equipmentPacket = PacketWrapper.create(ClientboundPackets1_14.SET_EQUIPPED_ITEM, null, event.user());

View File

@ -222,7 +222,7 @@ public class ItemPacketRewriter1_14 extends ItemRewriter<ClientboundPackets1_13,
resyncPacket.write(Types.VAR_INT, 5); // 4 - Mode - Drag
CompoundTag tag = new CompoundTag();
tag.put("force_resync", new DoubleTag(Double.NaN)); // Tags with NaN are not equal
resyncPacket.write(Types.ITEM1_13_2, new DataItem(1, (byte) 1, (short) 0, tag)); // 5 - Clicked Item
resyncPacket.write(Types.ITEM1_13_2, new DataItem(1, (byte) 1, tag)); // 5 - Clicked Item
resyncPacket.scheduleSendToServer(Protocol1_13_2To1_14.class);
});

View File

@ -80,7 +80,7 @@ public final class Protocol1_17To1_17_1 extends AbstractProtocol<ClientboundPack
registerServerbound(ServerboundPackets1_17.EDIT_BOOK, wrapper -> {
CompoundTag tag = new CompoundTag();
Item item = new DataItem(942, (byte) 1, (short) 0, tag); // Magic value for writable books
Item item = new DataItem(942, (byte) 1, tag); // Magic value for writable books
// Write the item, edit the tag down the line
wrapper.write(Types.ITEM1_13_2, item);

View File

@ -391,7 +391,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
final StructuredData<CompoundTag> customData = data.getNonEmpty(StructuredDataKey.CUSTOM_DATA);
final CompoundTag tag = customData != null ? customData.value() : new CompoundTag();
final DataItem dataItem = new DataItem(item.identifier(), (byte) item.amount(), (short) 0, tag);
final DataItem dataItem = new DataItem(item.identifier(), (byte) item.amount(), tag);
if (customData != null && tag.remove(nbtTagName()) != null) {
return dataItem;
}
@ -1204,7 +1204,7 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
final byte count = item.getByte("Count", (byte) 1);
final CompoundTag tag = item.getCompoundTag("tag");
return handleItemToClient(connection, new DataItem(itemId, count, (short) 0, tag));
return handleItemToClient(connection, new DataItem(itemId, count, tag));
}
private void updateEnchantments(final StructuredDataContainer data, final CompoundTag tag, final String key,