3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-10-03 08:41:05 +02:00

Replace DataItem constructor usages (#3893)

Dieser Commit ist enthalten in:
EnZaXD 2024-05-30 10:42:55 +02:00 committet von GitHub
Ursprung 03e8eec12e
Commit 5245a7ef2e
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
4 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -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,