3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-20 06:50:08 +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)); final Item output = handleNonEmptyItemToClient(wrapper.user(), wrapper.read(Types.ITEM1_20_2));
wrapper.write(Types1_20_5.ITEM, output); 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.write(Types1_20_5.OPTIONAL_ITEM_COST, secondInput);
wrapper.passthrough(Types.BOOLEAN); // Out of stock 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 handleClientboundItem(wrapper); // Result
final Item secondInput = wrapper.read(optionalCostType); Item secondInput = wrapper.read(optionalCostType);
wrapper.write(mappedOptionalCostType, handleItemToClient(wrapper.user(), secondInput)); if (secondInput != null) {
handleItemToClient(wrapper.user(), secondInput);
}
wrapper.write(mappedOptionalCostType, secondInput);
wrapper.passthrough(Types.BOOLEAN); // Out of stock wrapper.passthrough(Types.BOOLEAN); // Out of stock
wrapper.passthrough(Types.INT); // Number of trade uses wrapper.passthrough(Types.INT); // Number of trade uses