Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-27 16:40:10 +01:00
Handle optional item cost nullability
Dieser Commit ist enthalten in:
Ursprung
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));
|
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
|
||||||
|
@ -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
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren