Merge branch 'feature/1.20.5' into dev

This commit is contained in:
AJ Ferguson 2024-04-24 23:39:26 -04:00
commit 80250660f9
2 changed files with 3 additions and 9 deletions

View file

@ -369,7 +369,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
this.writeVarInt(buf, item.getAmount());
DataComponents dataComponents = item.getDataComponents();
if (item.getDataComponents() == null) {
if (dataComponents == null) {
this.writeVarInt(buf, 0);
return;
}

View file

@ -29,10 +29,7 @@ public class ClientboundMerchantOffersPacket implements MinecraftPacket {
for (int i = 0; i < trades.length; i++) {
ItemStack firstInput = helper.readTradeItemStack(in);
ItemStack output = helper.readOptionalItemStack(in);
ItemStack secondInput = null;
if (in.readBoolean()) {
secondInput = helper.readTradeItemStack(in);
}
ItemStack secondInput = helper.readNullable(in, helper::readTradeItemStack);
boolean tradeDisabled = in.readBoolean();
int numUses = in.readInt();
@ -59,10 +56,7 @@ public class ClientboundMerchantOffersPacket implements MinecraftPacket {
for (VillagerTrade trade : this.trades) {
helper.writeTradeItemStack(out, trade.getFirstInput());
helper.writeOptionalItemStack(out, trade.getOutput());
out.writeBoolean(trade.getSecondInput() != null);
if (trade.getSecondInput() != null) {
helper.writeTradeItemStack(out, trade.getSecondInput());
}
helper.writeNullable(out, trade.getSecondInput(), helper::writeTradeItemStack);
out.writeBoolean(trade.isTradeDisabled());
out.writeInt(trade.getNumUses());