Fix NMS ItemStack reflection issue

This commit is contained in:
Marc Baloup 2023-01-05 00:21:04 +01:00
parent 1557de2bdf
commit c4ab62c857
Signed by: marcbal
GPG Key ID: BBC0FE3ABC30B893

View File

@ -11,7 +11,7 @@ import static fr.pandacube.lib.util.ThrowableUtil.wrapReflectEx;
public class ItemStack extends ReflectWrapper { public class ItemStack extends ReflectWrapper {
public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.item.ItemStack")); public static final NMSReflect.ClassMapping MAPPING = wrapEx(() -> NMSReflect.mojClass("net.minecraft.world.item.ItemStack"));
private static final ReflectMethod<?> of = wrapEx(() -> MAPPING.mojMethod("of", CompoundTag.class)); private static final ReflectMethod<?> of = wrapEx(() -> MAPPING.mojMethod("of", CompoundTag.MAPPING));
public static ItemStack of(CompoundTag nbt) { public static ItemStack of(CompoundTag nbt) {
return wrap(wrapReflectEx(() -> of.invokeStatic(unwrap(nbt))), ItemStack.class); return wrap(wrapReflectEx(() -> of.invokeStatic(unwrap(nbt))), ItemStack.class);