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();
}
}
}
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();
}
}
}
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();
}
}
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);
}
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);
}
Aggregations