Search in sources :

Example 1 with FuelRecipeLogic

use of gregtech.api.capability.impl.FuelRecipeLogic in project GregTech by GregTechCEu.

the class SimpleGeneratorMetaTileEntity method createWorkable.

@Override
protected RecipeLogicEnergy createWorkable(RecipeMap<?> recipeMap) {
    final FuelRecipeLogic result = new FuelRecipeLogic(this, recipeMap, () -> energyContainer);
    result.enableOverclockVoltage();
    return result;
}
Also used : FuelRecipeLogic(gregtech.api.capability.impl.FuelRecipeLogic)

Example 2 with FuelRecipeLogic

use of gregtech.api.capability.impl.FuelRecipeLogic 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());
    });
}
Also used : OreDepositDefinition(gregtech.api.worldgen.config.OreDepositDefinition) ResourceLocation(net.minecraft.util.ResourceLocation) CustomItemReturnRecipeWrapper(gregtech.integration.jei.utils.CustomItemReturnRecipeWrapper) ModularUIGuiHandler(gregtech.api.gui.impl.ModularUIGuiHandler) AbstractRecipeLogic(gregtech.api.capability.impl.AbstractRecipeLogic) IControllable(gregtech.api.capability.IControllable) Material(gregtech.api.unification.material.type.Material) DustMaterial(gregtech.api.unification.material.type.DustMaterial) FuelRecipeMap(gregtech.api.recipes.machines.FuelRecipeMap) GTFuelRecipeWrapper(gregtech.integration.jei.recipe.fuel.GTFuelRecipeWrapper) RecipeMapFurnace(gregtech.api.recipes.machines.RecipeMapFurnace) MultiblockInfoPage(gregtech.integration.jei.multiblock.MultiblockInfoPage) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) FuelRecipeLogic(gregtech.api.capability.impl.FuelRecipeLogic) DustMaterial(gregtech.api.unification.material.type.DustMaterial) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

FuelRecipeLogic (gregtech.api.capability.impl.FuelRecipeLogic)2 IControllable (gregtech.api.capability.IControllable)1 AbstractRecipeLogic (gregtech.api.capability.impl.AbstractRecipeLogic)1 ModularUIGuiHandler (gregtech.api.gui.impl.ModularUIGuiHandler)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 FuelRecipeMap (gregtech.api.recipes.machines.FuelRecipeMap)1 RecipeMapFurnace (gregtech.api.recipes.machines.RecipeMapFurnace)1 DustMaterial (gregtech.api.unification.material.type.DustMaterial)1 Material (gregtech.api.unification.material.type.Material)1 OreDepositDefinition (gregtech.api.worldgen.config.OreDepositDefinition)1 MultiblockInfoPage (gregtech.integration.jei.multiblock.MultiblockInfoPage)1 GTFuelRecipeWrapper (gregtech.integration.jei.recipe.fuel.GTFuelRecipeWrapper)1 CustomItemReturnRecipeWrapper (gregtech.integration.jei.utils.CustomItemReturnRecipeWrapper)1 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)1 ResourceLocation (net.minecraft.util.ResourceLocation)1