NEI handlers, more suffering

This commit is contained in:
Bob 2023-08-05 20:09:21 +02:00
parent ef44b79f83
commit 93ded2740a
8 changed files with 108 additions and 9 deletions

View File

@ -14,6 +14,10 @@
* All current nether bedrock ores are tier 1 and do not require any bore fluid
* Custom machines now show their recipes in NEI
* All it took was battling NEI's source code for 3 hours and my sanity
* The chlorocalcite centrifugation process now requires 8,000mB of sulfuric acid instead of 100mB of water
* Mixed chlorocalcite solution now requires flux as a reducing agent
* All chlorine producing electrolysis recipes have been moved to the electrolysis machine and can no longer be done in the chemical plant
* If only there was a much simpler recipe that may have existed at some point, life could be a dream
## Fixed
* Fixed custom machines not sending fluid

View File

@ -0,0 +1,27 @@
package com.hbm.handler.nei;
import java.awt.Rectangle;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.gui.GUIElectrolyserFluid;
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes;
public class ElectrolyserFluidHandler extends NEIUniversalHandler {
public ElectrolyserFluidHandler() {
super("Electrolysis", ModBlocks.machine_electrolyser, ElectrolyserFluidRecipes.getRecipes());
}
@Override
public String getKey() {
return "ntmElectrolysisFluid";
}
@Override
public void loadTransferRects() {
super.loadTransferRects();
transferRectsGui.add(new RecipeTransferRect(new Rectangle(57, 15, 12, 40), "ntmElectrolysisFluid"));
guiGui.add(GUIElectrolyserFluid.class);
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
}
}

View File

@ -0,0 +1,27 @@
package com.hbm.handler.nei;
import java.awt.Rectangle;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.gui.GUIElectrolyserMetal;
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes;
public class ElectrolyserMetalHandler extends NEIUniversalHandler {
public ElectrolyserMetalHandler() {
super("Electrolysis", ModBlocks.machine_electrolyser, ElectrolyserMetalRecipes.getRecipes());
}
@Override
public String getKey() {
return "ntmElectrolysisMetal";
}
@Override
public void loadTransferRects() {
super.loadTransferRects();
transferRectsGui.add(new RecipeTransferRect(new Rectangle(2, 35, 22, 25), "ntmElectrolysisMetal"));
guiGui.add(GUIElectrolyserMetal.class);
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
}
}

View File

@ -399,15 +399,8 @@ public class ChemplantRecipes extends SerializableRecipe {
.inputFluids(new FluidStack(Fluids.MUSTARDGAS, 4000))
.outputItems(new ItemStack(ModItems.ammo_arty, 1, 11)));
recipes.add(new ChemRecipe(101, "CC_CENTRIFUGE", 200)
.inputFluids(new FluidStack(Fluids.CHLOROCALCITE_CLEANED, 500), new FluidStack(Fluids.WATER, 1_000))
.inputFluids(new FluidStack(Fluids.CHLOROCALCITE_CLEANED, 500), new FluidStack(Fluids.SULFURIC_ACID, 8_000))
.outputFluids(new FluidStack(Fluids.POTASSIUM_CHLORIDE, 250), new FluidStack(Fluids.CALCIUM_CHLORIDE, 250)));
recipes.add(new ChemRecipe(102, "PC_ELECTROLYSIS", 200)
.inputFluids(new FluidStack(Fluids.POTASSIUM_CHLORIDE, 250))
.outputItems(new ItemStack(ModItems.dust))
.outputFluids(new FluidStack(Fluids.CHLORINE, 125)));
recipes.add(new ChemRecipe(103, "CC_ELECTROLYSIS", 200)
.inputFluids(new FluidStack(Fluids.CALCIUM_CHLORIDE, 250))
.outputFluids(new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.CALCIUM_SOLUTION, 125)));
}
public static void registerFuelProcessing() {

View File

@ -1,7 +1,9 @@
package com.hbm.inventory.recipes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import com.google.gson.JsonElement;
@ -10,8 +12,10 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import net.minecraft.item.ItemStack;
@ -28,6 +32,25 @@ public class ElectrolyserFluidRecipes extends SerializableRecipe {
recipes.put(Fluids.CALCIUM_CHLORIDE, new ElectrolysisRecipe(250, new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.CALCIUM_SOLUTION, 125)));
}
public static HashMap getRecipes() {
HashMap<Object, Object[]> recipes = new HashMap<Object, Object[]>();
for(Entry<FluidType, ElectrolysisRecipe> entry : ElectrolyserFluidRecipes.recipes.entrySet()) {
ElectrolysisRecipe recipe = entry.getValue();
FluidStack input = new FluidStack(entry.getKey(), recipe.amount);
List outputs = new ArrayList();
if(recipe.output1.type != Fluids.NONE) outputs.add(ItemFluidIcon.make(recipe.output1));
if(recipe.output2.type != Fluids.NONE) outputs.add(ItemFluidIcon.make(recipe.output2));
for(ItemStack byproduct : recipe.byproduct) outputs.add(byproduct);
recipes.put(new ComparableStack(ItemFluidIcon.make(input)), outputs.toArray());
}
return recipes;
}
@Override
public String getFileName() {
return "hbmElectrolyzerFluid.json";

View File

@ -1,6 +1,7 @@
package com.hbm.inventory.recipes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
@ -12,11 +13,14 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.material.MaterialShapes;
import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.inventory.recipes.loader.SerializableRecipe;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.items.machine.ItemScraps;
import com.hbm.util.ItemStackUtil;
import net.minecraft.item.ItemStack;
@ -55,6 +59,25 @@ public class ElectrolyserMetalRecipes extends SerializableRecipe {
return null;
}
public static HashMap getRecipes() {
HashMap<Object[], Object[]> recipes = new HashMap<Object[], Object[]>();
for(Entry<AStack, ElectrolysisMetalRecipe> entry : ElectrolyserMetalRecipes.recipes.entrySet()) {
ElectrolysisMetalRecipe recipe = entry.getValue();
Object[] input = new Object[] { entry.getKey().copy(), new ComparableStack(ItemFluidIcon.make(Fluids.NITRIC_ACID, 100)) };
List outputs = new ArrayList();
if(recipe.output1 != null) outputs.add(ItemScraps.create(recipe.output1, true));
if(recipe.output2 != null) outputs.add(ItemScraps.create(recipe.output2, true));
for(ItemStack byproduct : recipe.byproduct) outputs.add(byproduct);
recipes.put(input, outputs.toArray());
}
return recipes;
}
@Override
public String getFileName() {
return "hbmElectrolyzerMetal.json";

View File

@ -79,7 +79,7 @@ public class MixerRecipes extends SerializableRecipe {
register(Fluids.CHLOROCALCITE_SOLUTION, new MixerRecipe(500, 50).setStack1(new FluidStack(Fluids.WATER, 250)).setStack2(new FluidStack(Fluids.NITRIC_ACID, 250)).setSolid(new OreDictStack(CHLOROCALCITE.dust())));
register(Fluids.CHLOROCALCITE_MIX, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.CHLOROCALCITE_SOLUTION, 500)).setStack2(new FluidStack(Fluids.SULFURIC_ACID, 500)));
register(Fluids.CHLOROCALCITE_MIX, new MixerRecipe(1000, 50).setStack1(new FluidStack(Fluids.CHLOROCALCITE_SOLUTION, 500)).setStack2(new FluidStack(Fluids.SULFURIC_ACID, 500)).setSolid(new ComparableStack(ModItems.powder_flux)));
}
public static void register(FluidType type, MixerRecipe... rec) {

View File

@ -73,6 +73,8 @@ public class NEIConfig implements IConfigureNEI {
registerHandler(new SawmillHandler());
registerHandler(new MixerHandler());
registerHandler(new OutgasserHandler());
registerHandler(new ElectrolyserFluidHandler());
registerHandler(new ElectrolyserMetalHandler());
for(MachineConfiguration conf : CustomMachineConfigJSON.niceList) registerHandlerBypass(new CustomMachineHandler(conf));