Improve JEI support
Now includes subtype interpreters for retextured blocks and shows the anvil on the modifiers tab
@@ -36,6 +36,7 @@ import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
+import slimeknights.mantle.item.RetexturedBlockItem;
import slimeknights.mantle.recipe.RecipeHelper;
import slimeknights.tconstruct.fluids.TinkerFluids;
import slimeknights.tconstruct.library.materials.IMaterial;
@@ -170,10 +171,18 @@ public class JEIPlugin implements IModPlugin {
registry.addRecipeCatalyst(new ItemStack(TinkerSmeltery.smelteryController), TConstructRecipeCategoryUid.melting, TConstructRecipeCategoryUid.alloy, TConstructRecipeCategoryUid.entityMelting);
registry.addRecipeCatalyst(new ItemStack(TinkerSmeltery.searedHeater), VanillaRecipeCategoryUid.FUEL);
registry.addRecipeCatalyst(new ItemStack(TinkerTables.tinkerStation), TConstructRecipeCategoryUid.modifiers);
+ registry.addRecipeCatalyst(new ItemStack(TinkerTables.tinkersAnvil), TConstructRecipeCategoryUid.modifiers);
}
@Override
public void registerItemSubtypes(ISubtypeRegistration registry) {
+ // retexturable blocks
+ ISubtypeInterpreter tables = new RetexturedSubtypeInterpreter();
+ registry.registerSubtypeInterpreter(TinkerTables.craftingStation.asItem(), tables);
+ registry.registerSubtypeInterpreter(TinkerTables.partBuilder.asItem(), tables);
+ registry.registerSubtypeInterpreter(TinkerTables.tinkerStation.asItem(), tables);
+ registry.registerSubtypeInterpreter(TinkerTables.tinkersAnvil.asItem(), tables);
+
ISubtypeInterpreter toolPartInterpreter = itemStack -> {
IMaterial material = IMaterialItem.getMaterialFromStack(itemStack);
if (material == IMaterial.UNKNOWN) {
@@ -279,4 +288,19 @@ public class JEIPlugin implements IModPlugin {
return NONE;
}
}
+
+ public static class RetexturedSubtypeInterpreter implements ISubtypeInterpreter {
+ @Override
+ public String apply(ItemStack itemStack) {
+ return NONE;
+ }
+
+ @Override
+ public String apply(ItemStack itemStack, UidContext context) {
+ if (context == UidContext.Ingredient) {
+ return RetexturedBlockItem.getTextureName(itemStack);
+ }
+ return NONE;
+ }
+ }
}
