mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
reforming recipes, catalytic reformer functionality
This commit is contained in:
parent
ef590afe30
commit
503fc11177
@ -12,7 +12,6 @@ import com.hbm.items.ItemAmmoEnums.Ammo357Magnum;
|
||||
import com.hbm.lib.HbmCollection.EnumGunManufacturer;
|
||||
import com.hbm.particle.SpentCasing;
|
||||
import com.hbm.particle.SpentCasing.CasingType;
|
||||
import com.hbm.lib.HbmCollection;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.potion.HbmPotion;
|
||||
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
|
||||
@ -193,8 +192,12 @@ public class Gun357MagnumFactory {
|
||||
|
||||
config.name = "bio";
|
||||
config.manufacturer = EnumGunManufacturer.RYAN;
|
||||
|
||||
config.config = HbmCollection.acp45;
|
||||
|
||||
config.config.add(BulletConfigSyncingUtil.STEEL_REVOLVER);
|
||||
config.config.add(BulletConfigSyncingUtil.GOLD_REVOLVER);
|
||||
config.config.add(BulletConfigSyncingUtil.IRON_REVOLVER);
|
||||
config.config.add(BulletConfigSyncingUtil.LEAD_REVOLVER);
|
||||
config.config.add(BulletConfigSyncingUtil.DESH_REVOLVER);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
package com.hbm.inventory.recipes;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
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.recipes.loader.SerializableRecipe;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
|
||||
public class ReformingRecipes extends SerializableRecipe {
|
||||
|
||||
private static HashMap<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> recipes = new HashMap();
|
||||
|
||||
@Override
|
||||
public void registerDefaults() {
|
||||
recipes.put(Fluids.NAPHTHA, new Triplet(
|
||||
new FluidStack(Fluids.REFORMATE, 50),
|
||||
new FluidStack(Fluids.PETROLEUM, 15),
|
||||
new FluidStack(Fluids.HYDROGEN, 10)
|
||||
));
|
||||
recipes.put(Fluids.NAPHTHA_CRACK, new Triplet(
|
||||
new FluidStack(Fluids.REFORMATE, 50),
|
||||
new FluidStack(Fluids.AROMATICS, 10),
|
||||
new FluidStack(Fluids.HYDROGEN, 5)
|
||||
));
|
||||
}
|
||||
|
||||
public static Triplet<FluidStack, FluidStack, FluidStack> getOutput(FluidType type) {
|
||||
return recipes.get(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return "hbmReforming.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getRecipeObject() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readRecipe(JsonElement recipe) {
|
||||
JsonObject obj = (JsonObject) recipe;
|
||||
|
||||
FluidType input = Fluids.fromName(obj.get("input").getAsString());
|
||||
FluidStack output1 = this.readFluidStack(obj.get("output1").getAsJsonArray());
|
||||
FluidStack output2 = this.readFluidStack(obj.get("output2").getAsJsonArray());
|
||||
FluidStack output3 = this.readFluidStack(obj.get("output3").getAsJsonArray());
|
||||
|
||||
recipes.put(input, new Triplet(output1, output2, output3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
|
||||
Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>> rec = (Entry<FluidType, Triplet<FluidStack, FluidStack, FluidStack>>) recipe;
|
||||
|
||||
writer.name("input").value(rec.getKey().getName());
|
||||
writer.name("output1"); this.writeFluidStack(rec.getValue().getX(), writer);
|
||||
writer.name("output2"); this.writeFluidStack(rec.getValue().getY(), writer);
|
||||
writer.name("output3"); this.writeFluidStack(rec.getValue().getZ(), writer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecipes() {
|
||||
recipes.clear();
|
||||
}
|
||||
}
|
||||
@ -49,6 +49,7 @@ public abstract class SerializableRecipe {
|
||||
recipeHandlers.add(new CrystallizerRecipes());
|
||||
recipeHandlers.add(new FractionRecipes());
|
||||
recipeHandlers.add(new CrackingRecipes());
|
||||
recipeHandlers.add(new ReformingRecipes());
|
||||
recipeHandlers.add(new LiquefactionRecipes());
|
||||
recipeHandlers.add(new SolidificationRecipes());
|
||||
recipeHandlers.add(new BreederRecipes());
|
||||
|
||||
@ -1,15 +1,18 @@
|
||||
package com.hbm.tileentity.machine.oil;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.container.ContainerMachineCatalyticReformer;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineCatalyticReformer;
|
||||
import com.hbm.inventory.recipes.ReformingRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.IPersistentNBT;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.Tuple.Triplet;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
|
||||
import api.hbm.energy.IEnergyUser;
|
||||
@ -84,7 +87,32 @@ public class TileEntityMachineCatalyticReformer extends TileEntityMachineBase im
|
||||
}
|
||||
|
||||
private void reform() {
|
||||
//TODO: add recipe handler
|
||||
|
||||
Triplet<FluidStack, FluidStack, FluidStack> out = ReformingRecipes.getOutput(tanks[0].getTankType());
|
||||
if(out == null) {
|
||||
tanks[1].setTankType(Fluids.NONE);
|
||||
tanks[2].setTankType(Fluids.NONE);
|
||||
tanks[3].setTankType(Fluids.NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
tanks[1].setTankType(out.getX().type);
|
||||
tanks[2].setTankType(out.getY().type);
|
||||
tanks[3].setTankType(out.getZ().type);
|
||||
|
||||
if(power < 20_000) return;
|
||||
if(tanks[0].getFill() < 100) return;
|
||||
|
||||
if(tanks[1].getFill() + out.getX().fill > tanks[1].getMaxFill()) return;
|
||||
if(tanks[2].getFill() + out.getY().fill > tanks[2].getMaxFill()) return;
|
||||
if(tanks[3].getFill() + out.getZ().fill > tanks[3].getMaxFill()) return;
|
||||
|
||||
tanks[0].setFill(tanks[0].getFill() - 100);
|
||||
tanks[1].setFill(tanks[1].getFill() + out.getX().fill);
|
||||
tanks[2].setFill(tanks[2].getFill() + out.getY().fill);
|
||||
tanks[3].setFill(tanks[3].getFill() + out.getZ().fill);
|
||||
|
||||
power -= 20_000;
|
||||
}
|
||||
|
||||
private void updateConnections() {
|
||||
|
||||
BIN
src/main/resources/assets/hbm/textures/items/crackpipe.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/crackpipe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 344 B |
Binary file not shown.
|
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 7.3 KiB |
Loading…
x
Reference in New Issue
Block a user