Search in sources :

Example 1 with DustMaterial

use of gregtech.api.unification.material.type.DustMaterial in project GregTech by GregTechCE.

the class ProcessingCrushed method registerOre.

/*public static void register() {
	    ProcessingCrushed processing = new ProcessingCrushed();
		OrePrefix.clump.addProcessingHandler(processing);
		OrePrefix.shard.addProcessingHandler(processing);
		OrePrefix.crushed.addProcessingHandler(processing);
		OrePrefix.dirtyGravel.addProcessingHandler(processing);
	}*/
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    ItemStack stack = simpleStack.asItemStack();
    if (entry.material instanceof SolidMaterial) {
        SolidMaterial material = (SolidMaterial) entry.material;
        ItemStack impureDustStack = OreDictUnifier.get(OrePrefix.dustImpure, material);
        ItemStack dustStack = OreDictUnifier.get(OrePrefix.dust, material);
        DustMaterial byproductMaterial = GTUtility.selectItemInList(0, material, material.oreByProducts, DustMaterial.class);
        // fallback for dirtyGravel, shard & clump
        if (impureDustStack.isEmpty()) {
            impureDustStack = dustStack;
        }
        RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(stack).outputs(impureDustStack).duration(10).EUt(16).buildAndRegister();
        RecipeMap.MACERATOR_RECIPES.recipeBuilder().inputs(stack).outputs(impureDustStack).duration(100).EUt(24).chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial), 1000);
        RecipeMap.ORE_WASHER_RECIPES.recipeBuilder().inputs(stack).fluidInputs(ModHandler.getWater(1000)).outputs(OreDictUnifier.get(entry.orePrefix == OrePrefix.crushed ? OrePrefix.crushedPurified : OrePrefix.dustPure, material), OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
        RecipeMap.THERMAL_CENTRIFUGE_RECIPES.recipeBuilder().inputs(stack).duration((int) entry.material.getMass() * 20).outputs(OreDictUnifier.get(entry.orePrefix == OrePrefix.crushed ? OrePrefix.crushedCentrifuged : OrePrefix.dust, entry.material), OreDictUnifier.get(OrePrefix.dustTiny, byproductMaterial), OreDictUnifier.get(OrePrefix.dust, Materials.Stone)).buildAndRegister();
        if (material.washedIn != null) {
            DustMaterial washingByproduct = GTUtility.selectItemInList(3, material, material.oreByProducts, DustMaterial.class);
            RecipeMap.CHEMICAL_BATH_RECIPES.recipeBuilder().inputs(stack).fluidInputs(material.washedIn.getFluid(1000)).outputs(OreDictUnifier.get(entry.orePrefix == OrePrefix.crushed ? OrePrefix.crushedPurified : OrePrefix.dustPure, entry.material)).chancedOutput(OreDictUnifier.get(OrePrefix.dust, washingByproduct), 7000).chancedOutput(OreDictUnifier.get(OrePrefix.dust, Materials.Stone), 4000).duration(800).EUt(8).buildAndRegister();
        }
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack)

Example 2 with DustMaterial

use of gregtech.api.unification.material.type.DustMaterial in project GregTech by GregTechCE.

the class ProcessingDecomposition method registerOre.

// @Override
public void registerOre(UnificationEntry entry, String modName, SimpleItemStack itemStack) {
    if (entry.material instanceof FluidMaterial) {
        FluidMaterial material = (FluidMaterial) entry.material;
        if (!material.materialComponents.isEmpty() && (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING) || material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_CENTRIFUGING))) {
            // compute outputs
            ArrayList<ItemStack> outputs = new ArrayList<>();
            ArrayList<FluidStack> fluidOutputs = new ArrayList<>();
            int totalInputAmount = 0;
            for (MaterialStack component : material.materialComponents) {
                totalInputAmount += component.amount;
                if (component.material instanceof DustMaterial) {
                    outputs.add(OreDictUnifier.get(OrePrefix.dust, component.material, (int) component.amount));
                } else if (component.material instanceof FluidMaterial) {
                    FluidMaterial componentMaterial = (FluidMaterial) component.material;
                    fluidOutputs.add(componentMaterial.getFluid((int) (GTValues.L * component.amount)));
                }
            }
            // generate builder
            RecipeBuilder builder;
            if (material.hasFlag(Material.MatFlags.DECOMPOSITION_BY_ELECTROLYZING)) {
                builder = RecipeMap.ELECTROLYZER_RECIPES.recipeBuilder().duration((int) material.getProtons() * totalInputAmount * 8).EUt(Math.min(4, material.materialComponents.size()) * 30);
            } else {
                builder = RecipeMap.CENTRIFUGE_RECIPES.recipeBuilder().duration((int) material.getMass() * totalInputAmount * 2).EUt(30);
            }
            builder.outputs(outputs);
            builder.fluidOutputs(fluidOutputs);
            // finish builder
            if (entry.orePrefix == OrePrefix.dust) {
                builder.inputs(itemStack.asItemStack(totalInputAmount));
            } else {
                builder.fluidInputs(material.getFluid(GTValues.L * totalInputAmount));
            }
            // register recipe
            builder.buildAndRegister();
        }
    }
}
Also used : FluidMaterial(gregtech.api.unification.material.type.FluidMaterial) FluidStack(net.minecraftforge.fluids.FluidStack) MaterialStack(gregtech.api.unification.stack.MaterialStack) ArrayList(java.util.ArrayList) DustMaterial(gregtech.api.unification.material.type.DustMaterial) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack) ItemStack(net.minecraft.item.ItemStack) RecipeBuilder(gregtech.api.recipes.RecipeBuilder)

Example 3 with DustMaterial

use of gregtech.api.unification.material.type.DustMaterial in project GregTech by GregTechCE.

the class ProcessingPure method registerOre.

public void registerOre(UnificationEntry entry, String modName, SimpleItemStack simpleStack) {
    if (entry.material instanceof SolidMaterial) {
        SolidMaterial material = (SolidMaterial) entry.material;
        ItemStack stack = simpleStack.asItemStack();
        DustMaterial byproductMaterial = GTUtility.selectItemInList(1, material, material.oreByProducts, DustMaterial.class);
        ItemStack pureDustStack = OreDictUnifier.get(OrePrefix.dustPure, material);
        if (pureDustStack.isEmpty()) {
            // fallback for reduced & cleanGravel
            pureDustStack = OreDictUnifier.get(OrePrefix.dust, material);
        }
        RecipeMap.HAMMER_RECIPES.recipeBuilder().inputs(stack).outputs(OreDictUnifier.get(OrePrefix.dustPure, material)).duration(10).EUt(16).buildAndRegister();
        RecipeMap.MACERATOR_RECIPES.recipeBuilder().inputs(stack).outputs(pureDustStack).chancedOutput(OreDictUnifier.get(OrePrefix.dust, byproductMaterial), 1000).buildAndRegister();
    }
}
Also used : SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial) ItemStack(net.minecraft.item.ItemStack) SimpleItemStack(gregtech.api.unification.stack.SimpleItemStack)

Example 4 with DustMaterial

use of gregtech.api.unification.material.type.DustMaterial in project GregTech by GregTechCE.

the class MetaBlocks method init.

public static void init() {
    MACHINE = new BlockMachine();
    MACHINE.setRegistryName("machine");
    CABLE = new BlockCable(64, 2, 0);
    CABLE.setRegistryName("cable");
    BOILER_CASING = new BlockBoilerCasing();
    BOILER_CASING.setRegistryName("boiler_casing");
    METAL_CASING = new BlockMetalCasing();
    METAL_CASING.setRegistryName("metal_casing");
    TURBINE_CASING = new BlockTurbineCasing();
    TURBINE_CASING.setRegistryName("turbine_casing");
    MACHINE_CASING = new BlockMachineCasing();
    MACHINE_CASING.setRegistryName("machine_casing");
    MUTLIBLOCK_CASING = new BlockMultiblockCasing();
    MUTLIBLOCK_CASING.setRegistryName("multiblock_casing");
    WIRE_COIL = new BlockWireCoil();
    WIRE_COIL.setRegistryName("wire_coil");
    WARNING_SIGN = new BlockWarningSign();
    WARNING_SIGN.setRegistryName("warning_sign");
    GRANITE = new BlockGranite();
    GRANITE.setRegistryName("granite");
    BLACK_GRANITE = new StoneType(12, "black_granite", OrePrefix.oreBlackgranite, Materials.GraniteBlack, "gregtech:blocks/stones/granite/granite_black_stone", () -> GRANITE.withVariant(GraniteVariant.BLACK_GRANITE, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockGranite && ((BlockGranite) state.getBlock()).getVariant(state) == GraniteVariant.BLACK_GRANITE);
    RED_GRANITE = new StoneType(13, "red_granite", OrePrefix.oreRedgranite, Materials.GraniteRed, "gregtech:blocks/stones/granite/granite_red_stone", () -> GRANITE.withVariant(GraniteVariant.RED_GRANITE, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockGranite && ((BlockGranite) state.getBlock()).getVariant(state) == GraniteVariant.RED_GRANITE);
    MINERAL = new BlockMineral();
    MINERAL.setRegistryName("mineral");
    MARBLE = new StoneType(14, "marble", OrePrefix.oreMarble, Materials.Marble, "gregtech:blocks/stones/marble/marble_stone", () -> MINERAL.withVariant(MineralVariant.MARBLE, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockMineral && ((BlockMineral) state.getBlock()).getVariant(state) == BlockMineral.MineralVariant.MARBLE);
    BASALT = new StoneType(15, "basalt", OrePrefix.oreBasalt, Materials.Basalt, "gregtech:blocks/stones/basalt/basalt_stone", () -> MINERAL.withVariant(MineralVariant.BASALT, ChiselingVariant.NORMAL), state -> state.getBlock() instanceof BlockMineral && ((BlockMineral) state.getBlock()).getVariant(state) == BlockMineral.MineralVariant.BASALT);
    CONCRETE = new BlockConcrete();
    CONCRETE.setRegistryName("concrete");
    COMPRESSED = new HashMap<>();
    ORES = new ArrayList<>();
    StoneType.init();
    Material[] materialBuffer = new Material[16];
    Arrays.fill(materialBuffer, Materials._NULL);
    int generationIndex = 0;
    for (Material material : Material.MATERIAL_REGISTRY.getObjectsWithIds()) {
        if (material instanceof DustMaterial) {
            int id = Material.MATERIAL_REGISTRY.getIDForObject(material);
            int index = id / 16;
            if (index > generationIndex) {
                createCompressedBlock(materialBuffer, generationIndex);
                Arrays.fill(materialBuffer, Materials._NULL);
            }
            if (!OrePrefix.block.isIgnored(material)) {
                materialBuffer[id % 16] = material;
                generationIndex = index;
            }
            if (material.hasFlag(DustMaterial.MatFlags.GENERATE_ORE)) {
                createOreBlock((DustMaterial) material);
            }
        }
    }
    createCompressedBlock(materialBuffer, generationIndex);
}
Also used : java.util(java.util) GraniteVariant(gregtech.common.blocks.BlockGranite.GraniteVariant) Item(net.minecraft.item.Item) MetaTileEntities(gregtech.common.metatileentities.MetaTileEntities) MetaTileEntityRenderer(gregtech.api.render.MetaTileEntityRenderer) Materials(gregtech.api.unification.material.Materials) StoneType(gregtech.api.unification.ore.StoneType) Material(gregtech.api.unification.material.type.Material) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) StoneTypes(gregtech.api.unification.ore.StoneTypes) IProperty(net.minecraft.block.properties.IProperty) GregTechAPI(gregtech.api.GregTechAPI) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) ChiselingVariant(gregtech.common.blocks.StoneBlock.ChiselingVariant) OrePrefix(gregtech.api.unification.ore.OrePrefix) ModelLoader(net.minecraftforge.client.model.ModelLoader) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) DefaultStateMapper(net.minecraft.client.renderer.block.statemap.DefaultStateMapper) ClientProxy(gregtech.common.ClientProxy) Streams(com.google.common.collect.Streams) Collectors(java.util.stream.Collectors) IBlockState(net.minecraft.block.state.IBlockState) DustMaterial(gregtech.api.unification.material.type.DustMaterial) MineralVariant(gregtech.common.blocks.BlockMineral.MineralVariant) BlockMachine(gregtech.api.block.machines.BlockMachine) BlockMachine(gregtech.api.block.machines.BlockMachine) StoneType(gregtech.api.unification.ore.StoneType) Material(gregtech.api.unification.material.type.Material) DustMaterial(gregtech.api.unification.material.type.DustMaterial) DustMaterial(gregtech.api.unification.material.type.DustMaterial)

Example 5 with DustMaterial

use of gregtech.api.unification.material.type.DustMaterial in project GregTech by GregTechCE.

the class MetaBlocks method createOreBlock.

private static void createOreBlock(DustMaterial material, StoneType[] stoneTypes, int index) {
    BlockOre block = new BlockOre(material, stoneTypes);
    block.setRegistryName("ore_" + material + "_" + index);
    for (StoneType stoneType : stoneTypes) {
        GregTechAPI.oreBlockTable.computeIfAbsent(material, m -> new HashMap<>()).put(stoneType, block);
    }
    ORES.add(block);
}
Also used : java.util(java.util) GraniteVariant(gregtech.common.blocks.BlockGranite.GraniteVariant) Item(net.minecraft.item.Item) MetaTileEntities(gregtech.common.metatileentities.MetaTileEntities) MetaTileEntityRenderer(gregtech.api.render.MetaTileEntityRenderer) Materials(gregtech.api.unification.material.Materials) StoneType(gregtech.api.unification.ore.StoneType) Material(gregtech.api.unification.material.type.Material) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation) StoneTypes(gregtech.api.unification.ore.StoneTypes) IProperty(net.minecraft.block.properties.IProperty) GregTechAPI(gregtech.api.GregTechAPI) Block(net.minecraft.block.Block) Minecraft(net.minecraft.client.Minecraft) Side(net.minecraftforge.fml.relauncher.Side) ChiselingVariant(gregtech.common.blocks.StoneBlock.ChiselingVariant) OrePrefix(gregtech.api.unification.ore.OrePrefix) ModelLoader(net.minecraftforge.client.model.ModelLoader) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) DefaultStateMapper(net.minecraft.client.renderer.block.statemap.DefaultStateMapper) ClientProxy(gregtech.common.ClientProxy) Streams(com.google.common.collect.Streams) Collectors(java.util.stream.Collectors) IBlockState(net.minecraft.block.state.IBlockState) DustMaterial(gregtech.api.unification.material.type.DustMaterial) MineralVariant(gregtech.common.blocks.BlockMineral.MineralVariant) BlockMachine(gregtech.api.block.machines.BlockMachine) StoneType(gregtech.api.unification.ore.StoneType)

Aggregations

DustMaterial (gregtech.api.unification.material.type.DustMaterial)7 SimpleItemStack (gregtech.api.unification.stack.SimpleItemStack)4 ItemStack (net.minecraft.item.ItemStack)4 Material (gregtech.api.unification.material.type.Material)3 Streams (com.google.common.collect.Streams)2 GregTechAPI (gregtech.api.GregTechAPI)2 BlockMachine (gregtech.api.block.machines.BlockMachine)2 RecipeBuilder (gregtech.api.recipes.RecipeBuilder)2 MetaTileEntityRenderer (gregtech.api.render.MetaTileEntityRenderer)2 Materials (gregtech.api.unification.material.Materials)2 FluidMaterial (gregtech.api.unification.material.type.FluidMaterial)2 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)2 OrePrefix (gregtech.api.unification.ore.OrePrefix)2 StoneType (gregtech.api.unification.ore.StoneType)2 StoneTypes (gregtech.api.unification.ore.StoneTypes)2 ClientProxy (gregtech.common.ClientProxy)2 GraniteVariant (gregtech.common.blocks.BlockGranite.GraniteVariant)2 MineralVariant (gregtech.common.blocks.BlockMineral.MineralVariant)2 ChiselingVariant (gregtech.common.blocks.StoneBlock.ChiselingVariant)2 MetaTileEntities (gregtech.common.metatileentities.MetaTileEntities)2