Search in sources :

Example 1 with ISubtypeInterpreter

use of mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter in project ImmersiveEngineering by BluSunrize.

the class JEIHelper method registerItemSubtypes.

@Override
public void registerItemSubtypes(ISubtypeRegistry subtypeRegistry) {
    //NBT Ignorance
    subtypeRegistry.registerNbtInterpreter(Item.getItemFromBlock(IEContent.blockConveyor), new ISubtypeInterpreter() {

        @Nullable
        @Override
        public String getSubtypeInfo(@Nonnull ItemStack itemStack) {
            if (itemStack != null && ItemNBTHelper.hasKey(itemStack, "conveyorType"))
                return ItemNBTHelper.getString(itemStack, "conveyorType");
            return null;
        }
    });
    subtypeRegistry.registerNbtInterpreter(IEContent.itemBullet, new ISubtypeInterpreter() {

        @Nullable
        @Override
        public String getSubtypeInfo(@Nonnull ItemStack itemStack) {
            if (itemStack != null && itemStack.getMetadata() == 2 && ItemNBTHelper.hasKey(itemStack, "bullet"))
                return ItemNBTHelper.getString(itemStack, "bullet");
            return null;
        }
    });
}
Also used : ISubtypeInterpreter(mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter) ItemStack(net.minecraft.item.ItemStack) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 ISubtypeInterpreter (mezz.jei.api.ISubtypeRegistry.ISubtypeInterpreter)1 ItemStack (net.minecraft.item.ItemStack)1