use of gregtech.integration.jei.multiblock.MultiblockInfoPage in project GregTech by GregTechCE.
the class GTJeiPlugin method register.
@Override
public void register(IModRegistry registry) {
IJeiHelpers jeiHelpers = registry.getJeiHelpers();
registry.addRecipes(IntCircuitRecipeWrapper.create(), IntCircuitCategory.UID);
MultiblockInfoCategory.registerRecipes(registry);
registry.handleRecipes(CustomItemReturnShapedOreRecipeRecipe.class, recipe -> new CustomItemReturnRecipeWrapper(jeiHelpers, recipe), VanillaRecipeCategoryUid.CRAFTING);
registry.addRecipeRegistryPlugin(new FacadeRegistryPlugin());
ModularUIGuiHandler modularUIGuiHandler = new ModularUIGuiHandler(jeiHelpers.recipeTransferHandlerHelper());
registry.addAdvancedGuiHandlers(modularUIGuiHandler);
registry.addGhostIngredientHandler(modularUIGuiHandler.getGuiContainerClass(), modularUIGuiHandler);
registry.getRecipeTransferRegistry().addRecipeTransferHandler(modularUIGuiHandler, VanillaRecipeCategoryUid.CRAFTING);
for (RecipeMap<?> recipeMap : RecipeMap.getRecipeMaps()) {
List<GTRecipeWrapper> recipesList = recipeMap.getRecipeList().stream().filter(recipe -> !recipe.isHidden() && recipe.hasValidInputsForDisplay()).map(GTRecipeWrapper::new).collect(Collectors.toList());
registry.addRecipes(recipesList, GTValues.MODID + ":" + recipeMap.unlocalizedName);
}
for (FuelRecipeMap fuelRecipeMap : FuelRecipeMap.getRecipeMaps()) {
List<GTFuelRecipeWrapper> recipeList = fuelRecipeMap.getRecipeList().stream().map(GTFuelRecipeWrapper::new).collect(Collectors.toList());
registry.addRecipes(recipeList, GTValues.MODID + ":" + fuelRecipeMap.unlocalizedName);
}
for (ResourceLocation metaTileEntityId : GregTechAPI.META_TILE_ENTITY_REGISTRY.getKeys()) {
MetaTileEntity metaTileEntity = GregTechAPI.META_TILE_ENTITY_REGISTRY.getObject(metaTileEntityId);
assert metaTileEntity != null;
if (metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null) != null) {
IControllable workableCapability = metaTileEntity.getCapability(GregtechTileCapabilities.CAPABILITY_CONTROLLABLE, null);
if (workableCapability instanceof AbstractRecipeLogic) {
RecipeMap<?> recipeMap = ((AbstractRecipeLogic) workableCapability).recipeMap;
registry.addRecipeCatalyst(metaTileEntity.getStackForm(), GTValues.MODID + ":" + recipeMap.unlocalizedName);
if (recipeMap instanceof RecipeMapFurnace) {
registry.addRecipeCatalyst(metaTileEntity.getStackForm(), VanillaRecipeCategoryUid.SMELTING);
}
} else if (workableCapability instanceof FuelRecipeLogic) {
FuelRecipeMap recipeMap = ((FuelRecipeLogic) workableCapability).recipeMap;
registry.addRecipeCatalyst(metaTileEntity.getStackForm(), GTValues.MODID + ":" + recipeMap.unlocalizedName);
}
}
}
for (MetaTileEntity breweryTile : MetaTileEntities.BREWERY) {
registry.addRecipeCatalyst(breweryTile.getStackForm(), VanillaRecipeCategoryUid.BREWING);
}
String semiFluidMapId = GTValues.MODID + ":" + RecipeMaps.SEMI_FLUID_GENERATOR_FUELS.getUnlocalizedName();
registry.addRecipeCatalyst(MetaTileEntities.LARGE_BRONZE_BOILER.getStackForm(), semiFluidMapId);
registry.addRecipeCatalyst(MetaTileEntities.LARGE_STEEL_BOILER.getStackForm(), semiFluidMapId);
registry.addRecipeCatalyst(MetaTileEntities.LARGE_TITANIUM_BOILER.getStackForm(), semiFluidMapId);
registry.addRecipeCatalyst(MetaTileEntities.LARGE_TUNGSTENSTEEL_BOILER.getStackForm(), semiFluidMapId);
registry.addIngredientInfo(Objects.requireNonNull(Materials.Air.getFluid(1000)), VanillaTypes.FLUID, I18n.format("gregtech.machine.air_collector.jei_description"));
String primitiveBlastId = GTValues.MODID + ":" + "primitive_blast_furnace";
registry.addRecipes(RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES.stream().map(PrimitiveBlastRecipeWrapper::new).collect(Collectors.toList()), primitiveBlastId);
registry.addRecipeCatalyst(MetaTileEntities.PRIMITIVE_BLAST_FURNACE.getStackForm(), primitiveBlastId);
String cokeOvenId = GTValues.MODID + ":" + "coke_oven";
registry.addRecipes(RecipeMaps.COKE_OVEN_RECIPES.stream().map(CokeOvenRecipeWrapper::new).collect(Collectors.toList()), cokeOvenId);
registry.addRecipeCatalyst(MetaTileEntities.COKE_OVEN.getStackForm(), cokeOvenId);
List<OreByProduct> oreByproductList = new CopyOnWriteArrayList<>();
for (Material material : Material.MATERIAL_REGISTRY) {
if (material instanceof DustMaterial && OreDictUnifier.get(OrePrefix.ore, material) != ItemStack.EMPTY) {
final OreByProduct oreByProduct = new OreByProduct((DustMaterial) material);
if (oreByProduct.hasByProducts())
oreByproductList.add(oreByProduct);
}
}
String oreByProductId = GTValues.MODID + ":" + "ore_by_product";
registry.addRecipes(oreByproductList, oreByProductId);
for (MetaTileEntity machine : MetaTileEntities.MACERATOR) registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId);
for (MetaTileEntity machine : MetaTileEntities.ORE_WASHER) registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId);
for (MetaTileEntity machine : MetaTileEntities.CENTRIFUGE) registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId);
for (MetaTileEntity machine : MetaTileEntities.THERMAL_CENTRIFUGE) registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId);
for (MetaTileEntity machine : MetaTileEntities.CHEMICAL_BATH) registry.addRecipeCatalyst(machine.getStackForm(), oreByProductId);
// Ore Veins
List<OreDepositDefinition> oreVeins = WorldGenRegistry.getOreDeposits();
List<GTOreInfo> oreInfoList = new CopyOnWriteArrayList<>();
for (OreDepositDefinition vein : oreVeins) {
oreInfoList.add(new GTOreInfo(vein));
}
String oreSpawnID = GTValues.MODID + ":" + "ore_spawn_location";
registry.addRecipes(oreInfoList, oreSpawnID);
registry.addRecipeCatalyst(MetaItems.SCANNER.getStackForm(), oreSpawnID);
// Ore Veins End
ingredientRegistry = registry.getIngredientRegistry();
for (int i = 0; i <= IntCircuitIngredient.CIRCUIT_MAX; i++) {
registry.addIngredientInfo(IntCircuitIngredient.getIntegratedCircuit(i), VanillaTypes.ITEM, "metaitem.circuit.integrated.jei_description");
}
registry.addRecipeCatalyst(MetaTileEntities.WORKBENCH.getStackForm(), VanillaRecipeCategoryUid.CRAFTING);
for (MetaTileEntity machine : MetaTileEntities.FLUID_CANNER) {
registry.addIngredientInfo(machine.getStackForm(), VanillaTypes.ITEM, "gregtech.machine.fluid_canner.jei_description");
}
// Multiblock info page registration
MultiblockInfoCategory.multiblockRecipes.values().forEach(v -> {
MultiblockInfoPage infoPage = v.getInfoPage();
registry.addIngredientInfo(infoPage.getController().getStackForm(), VanillaTypes.ITEM, infoPage.getDescription());
});
}
Aggregations