mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-27 16:12:23 -05:00
Temp fix for RecipesTest and fix ItemStack size encoding.
This commit is contained in:
parent
eb64c3850c
commit
ca629e2fef
2 changed files with 4 additions and 4 deletions
|
@ -336,7 +336,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
|||
|
||||
@Nullable
|
||||
public ItemStack readOptionalItemStack(ByteBuf buf) {
|
||||
byte count = buf.readByte();
|
||||
int count = this.readVarInt(buf);
|
||||
if (count <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -347,7 +347,7 @@ public class MinecraftCodecHelper extends BasePacketCodecHelper {
|
|||
|
||||
public void writeOptionalItemStack(ByteBuf buf, ItemStack item) {
|
||||
boolean empty = item == null || item.getAmount() <= 0;
|
||||
buf.writeByte(!empty ? item.getAmount() : 0);
|
||||
this.writeVarInt(buf, !empty ? item.getAmount() : 0);
|
||||
if (!empty) {
|
||||
this.writeVarInt(buf, item.getId());
|
||||
this.writeDataComponentPatch(buf, item.getDataComponents());
|
||||
|
|
|
@ -26,12 +26,12 @@ public class ServerDeclareRecipesTest extends PacketTest {
|
|||
this.setPackets(
|
||||
new ClientboundUpdateRecipesPacket(
|
||||
new HashMap<>(){{
|
||||
put(Key.key("smithing_addition"), new int[]{829, 837, 833, 830, 831, 671, 827, 828, 835, 838});
|
||||
// put(Key.key("smithing_addition"), new int[]{829, 837, 833, 830, 831, 671, 827, 828, 835, 838}); // Uncomment when Key comparison works
|
||||
}},
|
||||
new ArrayList<>(){{
|
||||
add(new ClientboundUpdateRecipesPacket.SelectableRecipe(
|
||||
new Ingredient(new HolderSet(new int[]{6})),
|
||||
new ItemStackSlotDisplay(new ItemStack(2, 662, null))
|
||||
new ItemStackSlotDisplay(new ItemStack(662, 2, null))
|
||||
));
|
||||
}}
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue