Reflection Issue

 avatar
unknown
java
3 years ago
715 B
9
Indexable
/**
 * Reflection of the ItemStack.createStack(NBTTagCompound) method.
 * <br>
 * This method creates a new ItemStack from the given NBTTagCompound.
 * @param nbtTagCompound The NBTTagCompound to create the ItemStack from.
 * @return The ItemStack with the given NBTTagCompound.
 */
public static Object createStack(Object nbtTagCompound) {
    try {
        return CLASS.getMethod("createStack", new Class[] {Object.class}).invoke(CLASS, nbtTagCompound);

    } catch (Exception e) {
        e.printStackTrace();
        return ObjectUtils.Null.class;
    }
}

// Object.class is a placeholder > I can't get the type for the parameter there because i'm doing reflection, and the param is from NMS.
Editor is loading...