3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 00:22:51 +01:00

Handle optional item cost nullability

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-06-07 13:51:28 +02:00
Ursprung 842cb8dac5
Commit 1e244a126d
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
2 geänderte Dateien mit 12 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -307,7 +307,13 @@ public final class BlockItemPacketRewriter1_20_5 extends ItemRewriter<Clientboun
final Item output = handleNonEmptyItemToClient(wrapper.user(), wrapper.read(Types.ITEM1_20_2));
wrapper.write(Types1_20_5.ITEM, output);
final Item secondInput = handleItemToClient(wrapper.user(), wrapper.read(Types.ITEM1_20_2));
Item secondInput = wrapper.read(Types.ITEM1_20_2);
if (secondInput != null) {
secondInput = handleItemToClient(wrapper.user(), secondInput);
if (secondInput.isEmpty()) {
secondInput = null;
}
}
wrapper.write(Types1_20_5.OPTIONAL_ITEM_COST, secondInput);
wrapper.passthrough(Types.BOOLEAN); // Out of stock

Datei anzeigen

@ -296,8 +296,11 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
handleClientboundItem(wrapper); // Result
final Item secondInput = wrapper.read(optionalCostType);
wrapper.write(mappedOptionalCostType, handleItemToClient(wrapper.user(), secondInput));
Item secondInput = wrapper.read(optionalCostType);
if (secondInput != null) {
handleItemToClient(wrapper.user(), secondInput);
}
wrapper.write(mappedOptionalCostType, secondInput);
wrapper.passthrough(Types.BOOLEAN); // Out of stock
wrapper.passthrough(Types.INT); // Number of trade uses