mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2025-02-22 06:32:34 +01:00
Handle optional item cost nullability
This commit is contained in:
parent
842cb8dac5
commit
1e244a126d
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user