fixed some requests not working due to missing NBT data

Closes #108
This commit is contained in:
Ell 2021-12-28 12:04:53 +01:00
parent bcfd9e7bf9
commit bee6f7ef0b
2 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,6 @@ package de.ellpeck.prettypipes.misc;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.resources.ResourceLocation;
import java.util.function.BiFunction;
import java.util.function.Supplier;
@ -10,7 +9,7 @@ import java.util.function.Supplier;
public class ItemEquality {
public static final ItemEquality DAMAGE = new ItemEquality((stack, filter) -> stack.getDamageValue() == filter.getDamageValue(), false, Type.DAMAGE);
public static final ItemEquality NBT = new ItemEquality(ItemStack::isSameItemSameTags, false, Type.NBT);
public static final ItemEquality NBT = new ItemEquality(ItemStack::tagMatches, false, Type.NBT);
public static final ItemEquality MOD = new ItemEquality((stack, filter) -> stack.getItem().getCreatorModId(stack).equals(filter.getItem().getCreatorModId(filter)), true, Type.MOD);
public final Type type;

View file

@ -36,7 +36,8 @@ public class PacketRequest {
public static void toBytes(PacketRequest packet, FriendlyByteBuf buf) {
buf.writeBlockPos(packet.pos);
buf.writeItem(packet.stack);
// if we limit the tag here, non-shared data will be omitted, making the requested item not match the stored one
buf.writeItemStack(packet.stack, false);
buf.writeVarInt(packet.amount);
}