deltarune tomorrow

This commit is contained in:
Boblet 2025-06-05 15:38:29 +02:00
parent 25e20662e4
commit 60f05defe0
17 changed files with 599 additions and 124 deletions

View File

@ -5,6 +5,9 @@
* Starmetal .50 BMG now returns
* Overall better armor piercing stats than DU
* Not compatible with the M2, only usable in amat rifles
* Reworked chemical plant
* No longer needs template items for everything, comes with a convenient recipe selector GUI
* Three item and three fluids for in and outputs
## Changed
* The RBMK console's grid can now be rotated using a screwdriver
@ -20,6 +23,24 @@
* Tier 4 heart piece is now called "heart of darkness"
* Thermal sights now render dead mobs in black
* Guns now have unique scope overlays instead of reusing the .44 scope for everything
* The new chemplant has slightly altered recipes
* Very basic mixing recipes (e.g. coolant) have been removed, it's now required to use the mixer
* Water to hydrogen peroxide is now 1,000 : 1,000 (instead of 1,000 : 800)
* Sulfuric acid's peroxide requirement has been adjusted accordingly
* Nitric acid has an alternate recipe using air and water, however it takes 4x as long and has a base consumption of 2kHE/t
* Desh now only takes 10 seconds to produce instead of 15
* Laminate now only takes 50mB of either fluid per recipe and processes much quicker
* Ducrete now uses U238 in the form of ferrouranium, and no longer requires gravel at all
* All recipes for nuclear fuel production now have a higher base consumption
* Cordite now uses sawdust instead of wood planks and sugar
* Kevlar is now made from aromatics, nitric acid and chlorine (or phosgene in 528 mode)
* Electrolysis using the chemplant has been removed. Hydrogen can be made using water and coal (or coke), and oxygen can be distilled from intake air
* Solid nuclear waste can also be vitrified now
* Thorium salt reprocessing now only has a 50% chance to produce a U233 nugget and a 25% chance to produce nuclear waste, making it less absurdly powerful and easier to deal with the waste
* Glyphid meat processing is now less autistic
* Making rusty steel now only takes 2 seconds per recipe
* Perfluoromethyl can now also be made in the chemical plant (technically, the process isn't just simple mixing after all)
* Removed niter to nitric acid liquefaction recipe
## Fixed
* Conveyor ejectors should now correctly place items onto the back of splitters instead of on the output belts

View File

@ -7,6 +7,7 @@ import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineChemicalPlant extends BlockDummyable {
@ -27,4 +28,16 @@ public class MachineChemicalPlant extends BlockDummyable {
@Override public int[] getDimensions() { return new int[] {2, 0, 1, 1, 1, 1}; }
@Override public int getOffset() { return 1; }
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
x -= dir.offsetX;
z -= dir.offsetZ;
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++) {
if(i != 0 || j != 0) this.makeExtra(world, x + i, y, z + j);
}
}
}

View File

@ -305,7 +305,7 @@ public class Fluids {
PLASMA_BF = new FluidType("PLASMA_BF", 0xA7F1A3, 4, 5, 4, EnumSymbol.ANTIMATTER).setTemp(8500).addTraits(NOCON, NOID, PLASMA);
CARBONDIOXIDE = new FluidType("CARBONDIOXIDE", 0x404040, 3, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS, new FT_Polluting().release(PollutionType.POISON, POISON_MINOR));
PLASMA_DH3 = new FluidType("PLASMA_DH3", 0xFF83AA, 0, 4, 0, EnumSymbol.RADIATION).setTemp(3480).addTraits(NOCON, NOID, PLASMA);
HELIUM3 = new FluidType("HELIUM3", 0xFCF0C4, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS);
HELIUM3 = new FluidType("HELIUM3", 0xFCF0C4, 0, 0, 0, EnumSymbol.ASPHYXIANT).addTraits(GASEOUS).addContainers(new CD_Gastank(0xFD631F, 0xffffff));
DEATH = new FluidType("DEATH", 0x717A88, 2, 0, 1, EnumSymbol.ACID).setTemp(300).addTraits(new FT_Corrosive(80), new FT_Poison(true, 4), LEADCON, LIQUID, VISCOUS);
ETHANOL = new FluidType("ETHANOL", 0xe0ffff, 2, 3, 0, EnumSymbol.NONE).addContainers(new CD_Canister(0xEAFFF3)).addTraits(new FT_Flammable(75_000), new FT_Combustible(FuelGrade.HIGH, 200_000), LIQUID, P_FUEL);
HEAVYWATER = new FluidType("HEAVYWATER", 0x00a0b0, 1, 0, 0, EnumSymbol.NONE).addTraits(LIQUID);
@ -1008,6 +1008,6 @@ public class Fluids {
public static class CD_Gastank {
public int bottleColor, labelColor;
public CD_Gastank(int color1, int color2) { this.bottleColor = color1; this.labelColor = color2; }
public CD_Gastank(int bottle, int label) { this.bottleColor = bottle; this.labelColor = label; }
}
}

View File

@ -7,6 +7,7 @@ import java.util.Set;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
import com.hbm.inventory.gui.GuiInfoContainer;
@ -25,7 +26,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
public class FluidTank {
public class FluidTank implements Cloneable {
public static final FluidTank[] EMPTY_ARRAY = new FluidTank[0];
@ -54,38 +55,27 @@ public class FluidTank {
return this;
}
public void setFill(int i) {
fluid = i;
}
public void setFill(int i) { fluid = i; }
public void setTankType(FluidType type) {
if(type == null) {
type = Fluids.NONE;
}
if(this.type == type)
return;
if(type == null) type = Fluids.NONE;
if(this.type == type) return;
this.type = type;
this.setFill(0);
}
public FluidType getTankType() {
return type;
/** Changes type and pressure based on a fluid stack, useful for changing tank types based on recipes */
public FluidTank conform(FluidStack stack) {
this.setTankType(stack.type);
this.withPressure(stack.pressure);
return this;
}
public int getFill() {
return fluid;
}
public int getMaxFill() {
return maxFluid;
}
public int getPressure() {
return pressure;
}
public FluidType getTankType() { return type; }
public int getFill() { return fluid; }
public int getMaxFill() { return maxFluid; }
public int getPressure() { return pressure; }
public int changeTankSize(int size) {
maxFluid = size;
@ -95,20 +85,15 @@ public class FluidTank {
fluid = maxFluid;
return dif;
}
return 0;
}
//Fills tank from canisters
public boolean loadTank(int in, int out, ItemStack[] slots) {
if(slots[in] == null)
return false;
if(slots[in] == null) return false;
boolean isInfiniteBarrel = slots[in].getItem() == ModItems.fluid_barrel_infinite;
if(!isInfiniteBarrel && pressure != 0)
return false;
if(!isInfiniteBarrel && pressure != 0) return false;
int prev = this.getFill();
@ -123,9 +108,7 @@ public class FluidTank {
//Fills canisters from tank
public boolean unloadTank(int in, int out, ItemStack[] slots) {
if(slots[in] == null)
return false;
if(slots[in] == null) return false;
int prev = this.getFill();

View File

@ -103,8 +103,8 @@ public class GUIMachineChemicalPlant extends GuiInfoContainer {
}
for(int i = 0; i < 3; i++) {
chemplant.inputTanks[i].renderTank(guiLeft + 8, guiTop + 52, this.zLevel, 16, 34);
chemplant.outputTanks[i].renderTank(guiLeft + 80, guiTop + 52, this.zLevel, 16, 34);
chemplant.inputTanks[i].renderTank(guiLeft + 8 + i * 18, guiTop + 52, this.zLevel, 16, 34);
chemplant.outputTanks[i].renderTank(guiLeft + 80 + i * 18, guiTop + 52, this.zLevel, 16, 34);
}
}
}

View File

@ -21,6 +21,7 @@ import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -223,7 +224,7 @@ public class GUIScreenRecipeSelector extends GuiScreen {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 240 / 1.0F, (float) 240 / 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
itemRender.zLevel = 100.0F;

View File

@ -26,6 +26,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.inventory.Container;
@ -188,7 +189,7 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa
if(font == null) font = fontRendererObj;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.enableGUIStandardItemLighting();
GL11.glDisable(GL11.GL_LIGHTING);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) 240 / 1.0F, (float) 240 / 1.0F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
itemRender.zLevel = layer;
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), stack, guiLeft + x, guiTop + y);

View File

@ -1,15 +1,20 @@
package com.hbm.inventory.recipes;
import static com.hbm.inventory.OreDictManager.*;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.inventory.FluidStack;
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.NTMMaterial;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.inventory.recipes.loader.GenericRecipes;
import com.hbm.items.ItemEnums.EnumFuelAdditive;
import com.hbm.items.ModItems;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
public class ChemicalPlantRecipes extends GenericRecipes<GenericRecipe> {
@ -27,28 +32,311 @@ public class ChemicalPlantRecipes extends GenericRecipes<GenericRecipe> {
@Override
public void registerDefaults() {
this.register(new GenericRecipe("chem.biogas").setup(60, 100).setIcon(ModItems.gas_full, Fluids.BIOGAS.getID())
.setInputItems(new ComparableStack(ModItems.biomass, 16))
.setInputFluids(new FluidStack(Fluids.AIR, 4000))
.setOutputFluids(new FluidStack(Fluids.BIOGAS, 2000)));
/// REGULAR FLUIDS ///
this.register(new GenericRecipe("chem.hydrogen").setupNamed(20, 400).setIcon(ModItems.gas_full, Fluids.HYDROGEN.getID())
.inputItems(new OreDictStack(COAL.gem(), 1))
.inputFluids(new FluidStack(Fluids.WATER, 8_000))
.outputFluids(new FluidStack(Fluids.HYDROGEN, 500)));
this.register(new GenericRecipe("chem.test").setup(60, 100)
.setInputItems(new ComparableStack(ModItems.biomass, 16))
.setInputFluids(new FluidStack(Fluids.AIR, 4000))
.setOutputItems(
new ChanceOutput(new ItemStack(ModItems.glyphid_meat, 16)),
new ChanceOutput(new ItemStack(ModItems.ingot_asbestos, 1), 0.5F, 0),
new ChanceOutputMulti() {{
pool.add(new ChanceOutput(new ItemStack(ModItems.billet_co60), 1));
pool.add(new ChanceOutput(new ItemStack(ModItems.billet_cobalt), 5));
}})
.setOutputFluids(new FluidStack(Fluids.BIOGAS, 2000)));
this.register(new GenericRecipe("chem.hydrogencoke").setupNamed(20, 400).setIcon(ModItems.gas_full, Fluids.HYDROGEN.getID())
.inputItems(new OreDictStack(ANY_COKE.gem(), 1))
.inputFluids(new FluidStack(Fluids.WATER, 8_000))
.outputFluids(new FluidStack(Fluids.HYDROGEN, 500)));
this.register(new GenericRecipe("chem.oxygen").setupNamed(20, 400).setIcon(ModItems.gas_full, Fluids.OXYGEN.getID())
.inputFluids(new FluidStack(Fluids.AIR, 8_000))
.outputFluids(new FluidStack(Fluids.OXYGEN, 500)));
this.register(new GenericRecipe("chem.xenon").setupNamed(300, 1_000).setIcon(ModItems.gas_full, Fluids.XENON.getID())
.inputFluids(new FluidStack(Fluids.AIR, 16_000))
.outputFluids(new FluidStack(Fluids.XENON, 50)));
this.register(new GenericRecipe("chem.xenonoxy").setupNamed(20, 1_000).setIcon(ModItems.gas_full, Fluids.XENON.getID())
.inputFluids(new FluidStack(Fluids.AIR, 8_000), new FluidStack(Fluids.OXYGEN, 250))
.outputFluids(new FluidStack(Fluids.XENON, 50)));
this.register(new GenericRecipe("chem.helium3").setupNamed(200, 2_000).setIcon(ModItems.gas_full, Fluids.HELIUM3.getID())
.inputItems(new ComparableStack(ModBlocks.moon_turf, 8))
.outputFluids(new FluidStack(Fluids.HELIUM3, 1_000)));
this.register(new GenericRecipe("chem.co2").setup(60, 100)
.inputFluids(new FluidStack(Fluids.GAS, 1_000))
.outputFluids(new FluidStack(Fluids.CARBONDIOXIDE, 1_000)));
this.register(new GenericRecipe("chem.perfluoromethyl").setup(20, 100)
.inputItems(new OreDictStack(F.dust()))
.inputFluids(new FluidStack(Fluids.PETROLEUM, 1_000), new FluidStack(Fluids.UNSATURATEDS, 500))
.outputFluids(new FluidStack(Fluids.PERFLUOROMETHYL, 1_000)));
this.register(new GenericRecipe("chem.cccentrifuge").setup(200, 100)
.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)));
/// OILS ///
this.register(new GenericRecipe("chem.ethanol").setupNamed(50, 100).setIcon(ModItems.canister_full, Fluids.ETHANOL.getID())
.inputItems(new ComparableStack(Items.sugar, 10))
.outputFluids(new FluidStack(Fluids.ETHANOL, 1000)));
this.register(new GenericRecipe("chem.biogas").setupNamed(60, 100).setIcon(ModItems.gas_full, Fluids.BIOGAS.getID())
.inputItems(new ComparableStack(ModItems.biomass, 16))
.inputFluids(new FluidStack(Fluids.AIR, 4_000))
.outputFluids(new FluidStack(Fluids.BIOGAS, 2_000)));
this.register(new GenericRecipe("chem.biofuel").setupNamed(60, 100).setIcon(ModItems.canister_full, Fluids.BIOFUEL.getID())
.inputFluids(new FluidStack(Fluids.BIOGAS, 1_500), new FluidStack(Fluids.ETHANOL, 250))
.outputFluids(new FluidStack(Fluids.BIOFUEL, 1_000)));
this.register(new GenericRecipe("chem.reoil").setupNamed(40, 100).setIcon(ModItems.canister_full, Fluids.RECLAIMED.getID())
.inputFluids(new FluidStack(Fluids.SMEAR, 1_000))
.outputFluids(new FluidStack(Fluids.RECLAIMED, 800)));
this.register(new GenericRecipe("chem.gasoline").setupNamed(40, 100).setIcon(ModItems.canister_full, Fluids.GASOLINE.getID())
.inputFluids(new FluidStack(Fluids.NAPHTHA, 1000))
.outputFluids(new FluidStack(Fluids.GASOLINE, 800)));
this.register(new GenericRecipe("chem.tarsand").setupNamed(200, 100).setIcon(ModBlocks.ore_oil_sand)
.inputItems(new ComparableStack(ModBlocks.ore_oil_sand, 16), new OreDictStack(ANY_TAR.any(), 1))
.outputItems(new ItemStack(Blocks.sand, 16))
.outputFluids(new FluidStack(Fluids.BITUMEN, 1_000)));
this.register(new GenericRecipe("chem.tel").setup(40, 100)
.inputItems(new OreDictStack(ANY_TAR.any()), new OreDictStack(PB.dust()))
.inputFluids(new FluidStack(Fluids.PETROLEUM, 100), new FluidStack(Fluids.STEAM, 1000))
.outputItems(DictFrame.fromOne(ModItems.fuel_additive, EnumFuelAdditive.ANTIKNOCK)));
this.register(new GenericRecipe("chem.deicer").setup(40, 100)
.inputFluids(new FluidStack(Fluids.GAS, 100), new FluidStack(Fluids.HYDROGEN, 50))
.outputItems(DictFrame.fromOne(ModItems.fuel_additive, EnumFuelAdditive.DEICER)));
/// THE CONC AND ASPHALE ///
this.register(new GenericRecipe("chem.concrete").setup(100, 100)
.inputItems(new ComparableStack(ModItems.powder_cement, 1), new ComparableStack(Blocks.gravel, 8), new OreDictStack(KEY_SAND, 8))
.inputFluids(new FluidStack(Fluids.WATER, 2_000))
.outputItems(new ItemStack(ModBlocks.concrete_smooth, 16)));
this.register(new GenericRecipe("chem.concreteasbestos").setup(100, 100)
.inputItems(new ComparableStack(ModItems.powder_cement, 4), new OreDictStack(ASBESTOS.ingot(), (GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleChemsitry) ? 1 : 4), new OreDictStack(KEY_SAND, 8))
.inputFluids(new FluidStack(Fluids.WATER, 2_000))
.outputItems(new ItemStack(ModBlocks.concrete_asbestos, 16)));
this.register(new GenericRecipe("chem.ducrete").setup(150, 100)
.inputItems(new ComparableStack(ModItems.powder_cement, 4), new OreDictStack(FERRO.ingot()), new OreDictStack(KEY_SAND, 8))
.inputFluids(new FluidStack(Fluids.WATER, 2_000))
.outputItems(new ItemStack(ModBlocks.ducrete_smooth, 8)));
this.register(new GenericRecipe("chem.asphalt").setup(100, 100)
.inputItems(new ComparableStack(Blocks.gravel, 2), new OreDictStack(KEY_SAND, 6))
.inputFluids(new FluidStack(Fluids.BITUMEN, 1_000))
.outputItems(new ItemStack(ModBlocks.asphalt, 16)));
/// SOLIDS ///
this.register(new GenericRecipe("chem.desh").setup(200, 100)
.inputItems(new ComparableStack(ModItems.powder_desh_mix))
.inputFluids((GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleChemsitry) ?
new FluidStack[] {new FluidStack(Fluids.LIGHTOIL, 200)} :
new FluidStack[] {new FluidStack(Fluids.LIGHTOIL, 200), new FluidStack(Fluids.MERCURY, 200)})
.outputItems(new ItemStack(ModItems.ingot_desh)));
this.register(new GenericRecipe("chem.polymer").setup(100, 100)
.inputItems(new OreDictStack(COAL.dust(), 2), new OreDictStack(F.dust()))
.inputFluids(new FluidStack(Fluids.PETROLEUM, 500, GeneralConfig.enable528 ? 1 : 0))
.outputItems(new ItemStack(ModItems.ingot_polymer)));
this.register(new GenericRecipe("chem.bakelite").setup(100, 100)
.inputFluids(new FluidStack(Fluids.AROMATICS, 500, GeneralConfig.enable528 ? 1 : 0), new FluidStack(Fluids.PETROLEUM, 500, GeneralConfig.enable528 ? 1 : 0))
.outputItems(new ItemStack(ModItems.ingot_bakelite)));
this.register(new GenericRecipe("chem.rubber").setup(100, 200)
.inputItems(new OreDictStack(S.dust()))
.inputFluids(new FluidStack(Fluids.UNSATURATEDS, 500, GeneralConfig.enable528 ? 2 : 0))
.outputItems(new ItemStack(ModItems.ingot_rubber)));
this.register(new GenericRecipe("chem.hardplastic").setup(100, 1_000)
.inputFluids(new FluidStack(Fluids.XYLENE, 500, GeneralConfig.enable528 ? 2 : 0), new FluidStack(Fluids.PHOSGENE, 500, GeneralConfig.enable528 ? 2 : 0))
.outputItems(new ItemStack(ModItems.ingot_pc)));
this.register(new GenericRecipe("chem.pvc").setup(100, 1_000)
.inputItems(new OreDictStack(CD.dust()))
.inputFluids(new FluidStack(Fluids.UNSATURATEDS, 250, GeneralConfig.enable528 ? 2 : 0), new FluidStack(Fluids.CHLORINE, 250, GeneralConfig.enable528 ? 2 : 0))
.outputItems(new ItemStack(ModItems.ingot_pvc, 2)));
this.register(new GenericRecipe("chem.kevlar").setup(20, 300)
.inputFluids(new FluidStack(Fluids.AROMATICS, 200), new FluidStack(Fluids.NITRIC_ACID, 100), new FluidStack(GeneralConfig.enable528 ? Fluids.PHOSGENE : Fluids.CHLORINE, 100))
.outputItems(new ItemStack(ModItems.plate_kevlar, 4)));
this.register(new GenericRecipe("chem.meth").setup(30, 300)
.inputItems(new ComparableStack(Items.wheat), new ComparableStack(Items.dye, 2, 3))
.inputFluids(new FluidStack(Fluids.LUBRICANT, 400), new FluidStack(Fluids.PEROXIDE, 500))
.outputItems(new ItemStack(ModItems.chocolate, 4)));
this.register(new GenericRecipe("chem.epearl").setup(100, 300)
.inputItems(new OreDictStack(DIAMOND.dust(), 1))
.inputFluids(new FluidStack(Fluids.XPJUICE, 500))
.outputFluids(new FluidStack(Fluids.ENDERJUICE, 100)));
this.register(new GenericRecipe("chem.meatprocessing").setupNamed(200, 200).setIcon(ModItems.glyphid_meat)
.inputItems(new OreDictStack(KEY_GLYPHID_MEAT, 3))
.inputFluids(new FluidStack(Fluids.WATER, 1_000))
.outputItems(new ItemStack(ModItems.sulfur, 4), new ItemStack(ModItems.niter, 3))
.outputFluids(new FluidStack(Fluids.SALIENT, 250)));
this.register(new GenericRecipe("chem.rustysteel").setup(40, 100)
.inputItems(new ComparableStack(ModBlocks.deco_steel, 8))
.inputFluids(new FluidStack(Fluids.WATER, 1000))
.outputItems(new ItemStack(ModBlocks.deco_rusty_steel, 8)));
/// ACIDS ///
this.register(new GenericRecipe("chem.peroxide").setup(50, 100)
.inputFluids(new FluidStack(Fluids.WATER, 1_000))
.outputFluids(new FluidStack(Fluids.PEROXIDE, 1_000)));
this.register(new GenericRecipe("chem.sulfuricacid").setup(50, 100)
.inputItems(new OreDictStack(S.dust()))
.inputFluids(new FluidStack(Fluids.PEROXIDE, 1_000), new FluidStack(Fluids.WATER, 1_000))
.outputFluids(new FluidStack(Fluids.SULFURIC_ACID, 2_000)));
this.register(new GenericRecipe("chem.nitricacid").setup(50, 100)
.inputItems(new OreDictStack(KNO.dust()))
.inputFluids(new FluidStack(Fluids.SULFURIC_ACID, 500))
.outputFluids(new FluidStack(Fluids.NITRIC_ACID, 1_000)));
this.register(new GenericRecipe("chem.birkeland").setupNamed(200, 5_000)
.inputFluids(new FluidStack(Fluids.AIR, 8_000), new FluidStack(Fluids.WATER, 2_000))
.outputFluids(new FluidStack(Fluids.NITRIC_ACID, 1_000)));
this.register(new GenericRecipe("chem.schrabidic").setup(100, 5_000)
.inputItems(new ComparableStack(ModItems.pellet_charged))
.inputFluids(new FluidStack(Fluids.SAS3, 8000), new FluidStack(Fluids.PEROXIDE, 6000))
.outputFluids(new FluidStack(Fluids.SCHRABIDIC, 16000)));
this.register(new GenericRecipe("chem.schrabidate").setup(150, 5_000)
.inputFluids(new FluidStack(Fluids.SCHRABIDIC, 250))
.outputItems(new ItemStack(ModItems.powder_schrabidate)));
/// COLTAN ///
this.register(new GenericRecipe("chem.coltancleaning").setup(60, 100)
.inputItems(new OreDictStack(COLTAN.dust(), 2), new OreDictStack(COAL.dust()))
.inputFluids(new FluidStack(Fluids.PEROXIDE, 250), new FluidStack(Fluids.HYDROGEN, 500))
.outputItems(new ItemStack(ModItems.powder_coltan), new ItemStack(ModItems.powder_niobium), new ItemStack(ModItems.dust))
.outputFluids(new FluidStack(Fluids.WATER, 500)));
this.register(new GenericRecipe("chem.coltanpain").setup(120, 100)
.inputItems(new ComparableStack(ModItems.powder_coltan), new OreDictStack(F.dust()))
.inputFluids(new FluidStack(Fluids.GAS, 1000), new FluidStack(Fluids.OXYGEN, 500))
.outputFluids(new FluidStack(Fluids.PAIN, 1000)));
this.register(new GenericRecipe("chem.coltancrystal").setup(80, 100)
.inputFluids(new FluidStack(Fluids.PAIN, 1000), new FluidStack(Fluids.PEROXIDE, 500))
.outputItems(new ItemStack(ModItems.gem_tantalium), new ItemStack(ModItems.dust, 3))
.outputFluids(new FluidStack(Fluids.WATER, 250)));
/// EXPLOSIVES ///
this.register(new GenericRecipe("chem.cordite").setup(40, 100)
.inputItems(new OreDictStack(KNO.dust(), 2), new ComparableStack(ModItems.powder_sawdust, 2))
.inputFluids((GeneralConfig.enableLBSM && GeneralConfig.enableLBSMSimpleChemsitry) ? new FluidStack(Fluids.HEATINGOIL, 200) : new FluidStack(Fluids.GAS, 200))
.outputItems(new ItemStack(ModItems.cordite, 4)));
this.register(new GenericRecipe("chem.rocketfuel").setup(200, 100)
.inputItems(new ComparableStack(ModItems.solid_fuel, 2))
.inputFluids(new FluidStack(Fluids.PETROLEUM, 200, GeneralConfig.enable528 ? 1 : 0), new FluidStack(Fluids.NITRIC_ACID, 100))
.outputItems(new ItemStack(ModItems.rocket_fuel, 4)));
this.register(new GenericRecipe("chem.dynamite").setup(50, 100)
.inputItems(new ComparableStack(Items.sugar), new OreDictStack(KNO.dust()), new OreDictStack(KEY_SAND))
.outputItems(new ItemStack(ModItems.ball_dynamite, 2)));
this.register(new GenericRecipe("chem.tnt").setup(100, 1_000)
.inputItems(new OreDictStack(KNO.dust()))
.inputFluids(new FluidStack(Fluids.AROMATICS, 500, GeneralConfig.enable528 ? 1 : 0))
.outputItems(new ItemStack(ModItems.ball_tnt, 4)));
this.register(new GenericRecipe("chem.tatb").setup(50, 5_000)
.inputItems(new ComparableStack(ModItems.ball_tnt))
.inputFluids(new FluidStack(Fluids.SOURGAS, 200, 1), new FluidStack(Fluids.NITRIC_ACID, 10))
.outputItems(new ItemStack(ModItems.ball_tatb)));
this.register(new GenericRecipe("chem.c4").setup(100, 1_000)
.inputItems(new OreDictStack(KNO.dust()))
.inputFluids(new FluidStack(Fluids.UNSATURATEDS, 500, GeneralConfig.enable528 ? 1 : 0))
.outputItems(new ItemStack(ModItems.ingot_c4, 4)));
this.register(new GenericRecipe("chem.shellchlorine").setup(100, 1_000)
.inputItems(new ComparableStack(ModItems.ammo_arty, 1, 0), new OreDictStack(ANY_PLASTIC.ingot(), 1))
.inputFluids(new FluidStack(Fluids.CHLORINE, 4_000))
.outputItems(new ItemStack(ModItems.ammo_arty, 1, 9)));
this.register(new GenericRecipe("chem.shellphosgene").setup(100, 1_000)
.inputItems(new ComparableStack(ModItems.ammo_arty, 1, 0), new OreDictStack(ANY_PLASTIC.ingot(), 1))
.inputFluids(new FluidStack(Fluids.PHOSGENE, 4_000))
.outputItems(new ItemStack(ModItems.ammo_arty, 1, 10)));
this.register(new GenericRecipe("chem.shellmustard").setup(100, 1_000)
.inputItems(new ComparableStack(ModItems.ammo_arty, 1, 0), new OreDictStack(ANY_PLASTIC.ingot(), 1))
.inputFluids(new FluidStack(Fluids.MUSTARDGAS, 4_000))
.outputItems(new ItemStack(ModItems.ammo_arty, 1, 11)));
/// GLASS ///
this.register(new GenericRecipe("chem.laminate").setup(20, 100)
.inputFluids(new FluidStack(Fluids.XYLENE, 50), new FluidStack(Fluids.PHOSGENE, 50))
.inputItems(new OreDictStack(KEY_ANYGLASS), new OreDictStack(STEEL.bolt(), 4))
.outputItems(new ItemStack(ModBlocks.reinforced_laminate)));
/// NUCLEAR PROCESSING ///
this.register(new GenericRecipe("chem.yellowcake").setup(250, 500)
.inputItems(new OreDictStack(U.billet(), 2), new OreDictStack(S.dust(), 2))
.inputFluids(new FluidStack(Fluids.PEROXIDE, 500))
.outputItems(new ItemStack(ModItems.powder_yellowcake)));
this.register(new GenericRecipe("chem.uf6").setup(100, 500).setIcon(ModItems.fluid_icon, Fluids.UF6.getID())
.inputItems(new ComparableStack(ModItems.powder_yellowcake), new OreDictStack(F.dust(), 4))
.inputFluids(new FluidStack(Fluids.WATER, 1_000))
.outputItems(new ItemStack(ModItems.sulfur, 2))
.outputFluids(new FluidStack(Fluids.UF6, 1_200)));
this.register(new GenericRecipe("chem.puf6").setup(200, 500)
.inputItems(new OreDictStack(PU.dust()), new OreDictStack(F.dust(), 3))
.inputFluids(new FluidStack(Fluids.WATER, 1_000))
.outputFluids(new FluidStack(Fluids.PUF6, 900)));
this.register(new GenericRecipe("chem.sas3").setup(200, 5_000)
.inputItems(new OreDictStack(SA326.dust()), new OreDictStack(S.dust(), 2))
.inputFluids(new FluidStack(Fluids.PEROXIDE, 2_000))
.outputFluids(new FluidStack(Fluids.SAS3, 1_000)));
this.register(new GenericRecipe("chem.balefire").setup(100, 10_000).setIcon(ModItems.fluid_icon, Fluids.BALEFIRE.getID())
.inputItems(new ComparableStack(ModItems.egg_balefire_shard))
.inputFluids(new FluidStack(Fluids.KEROSENE, 6_000))
.outputItems(new ItemStack(ModItems.powder_balefire))
.outputFluids(new FluidStack(Fluids.BALEFIRE, 8_000)));
this.register(new GenericRecipe("chem.thoriumsalt").setup(100, 10_000).setIcon(ModItems.fluid_icon, Fluids.THORIUM_SALT.getID())
.inputFluids(new FluidStack(Fluids.THORIUM_SALT_DEPLETED, 16_000))
.inputItems(new OreDictStack(TH232.nugget(), 2))
.outputFluids(new FluidStack(Fluids.THORIUM_SALT, 16_000))
.outputItems(
new ChanceOutput(new ItemStack(ModItems.nugget_u233, 1), 0.5F),
new ChanceOutput(new ItemStack(ModItems.nuclear_waste_tiny, 1), 0.25F)));
/// VITRIFICATION ///
this.register(new GenericRecipe("chem.vitliquid").setup(100, 1_000)
.inputItems(new ComparableStack(ModBlocks.sand_lead))
.inputFluids(new FluidStack(Fluids.WASTEFLUID, 1_000))
.outputItems(new ItemStack(ModItems.nuclear_waste_vitrified)));
this.register(new GenericRecipe("chem.vitgaseous").setup(100, 1_000)
.inputItems(new ComparableStack(ModBlocks.sand_lead))
.inputFluids(new FluidStack(Fluids.WASTEGAS, 1_000))
.outputItems(new ItemStack(ModItems.nuclear_waste_vitrified)));
this.register(new GenericRecipe("chem.vitsolid").setup(300, 1_000)
.inputItems(new ComparableStack(ModBlocks.sand_lead), new ComparableStack(ModItems.nuclear_waste, 4))
.outputItems(new ItemStack(ModItems.nuclear_waste_vitrified, 4)));
/// OSMIRIDIUM ///
this.register(new GenericRecipe("chem.osmiridiumdeath").setup(240, 1_000)
.inputItems(new ComparableStack(ModItems.powder_paleogenite), new OreDictStack(F.dust(), 8), new ComparableStack(ModItems.nugget_bismuth, 4))
.inputFluids(new FluidStack(Fluids.PEROXIDE, 1_000, 5))
.outputFluids(new FluidStack(Fluids.DEATH, 1_000, 0)));
for(NTMMaterial mat : Mats.orderedList) {
if(mat.autogen.contains(MaterialShapes.CASTPLATE)) this.register(new GenericRecipe(mat.getUnlocalizedName() + ".plate").setup(60, 100).setOutputItems(new ChanceOutput(new ItemStack(ModItems.plate_cast, 1, mat.id))));
if(mat.autogen.contains(MaterialShapes.WELDEDPLATE)) this.register(new GenericRecipe(mat.getUnlocalizedName() + ".weld").setup(60, 100).setOutputItems(new ChanceOutput(new ItemStack(ModItems.plate_welded, 1, mat.id))));
if(mat.autogen.contains(MaterialShapes.DENSEWIRE)) this.register(new GenericRecipe(mat.getUnlocalizedName() + ".wire").setup(60, 100).setOutputItems(new ChanceOutput(new ItemStack(ModItems.wire_dense, 1, mat.id))));
if(mat.autogen.contains(MaterialShapes.MECHANISM)) this.register(new GenericRecipe(mat.getUnlocalizedName() + ".mechanism").setup(60, 100).setOutputItems(new ChanceOutput(new ItemStack(ModItems.part_mechanism, 1, mat.id))));
}
}
}

View File

@ -25,6 +25,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
@Deprecated
public class ChemplantRecipes extends SerializableRecipe {
/**
@ -419,7 +420,7 @@ public class ChemplantRecipes extends SerializableRecipe {
.outputItems(new ItemStack(ModBlocks.asphalt, 16)));
}
public static class ChemRecipe {
@Deprecated public static class ChemRecipe {
public int listing;
private int id;

View File

@ -33,43 +33,42 @@ public class LiquefactionRecipes extends SerializableRecipe {
public void registerDefaults() {
//oil processing
recipes.put(COAL.gem(), new FluidStack(100, Fluids.COALOIL));
recipes.put(COAL.dust(), new FluidStack(100, Fluids.COALOIL));
recipes.put(LIGNITE.gem(), new FluidStack(50, Fluids.COALOIL));
recipes.put(LIGNITE.dust(), new FluidStack(50, Fluids.COALOIL));
recipes.put(KEY_OIL_TAR, new FluidStack(75, Fluids.BITUMEN));
recipes.put(KEY_CRACK_TAR, new FluidStack(100, Fluids.BITUMEN));
recipes.put(KEY_COAL_TAR, new FluidStack(50, Fluids.BITUMEN));
recipes.put(KEY_LOG, new FluidStack(100, Fluids.MUG));
recipes.put(KNO.dust(), new FluidStack(750, Fluids.NITRIC_ACID));
recipes.put(NA.dust(), new FluidStack(100, Fluids.SODIUM));
recipes.put(PB.ingot(), new FluidStack(100, Fluids.LEAD));
recipes.put(PB.dust(), new FluidStack(100, Fluids.LEAD));
recipes.put(COAL.gem(), new FluidStack(100, Fluids.COALOIL));
recipes.put(COAL.dust(), new FluidStack(100, Fluids.COALOIL));
recipes.put(LIGNITE.gem(), new FluidStack(50, Fluids.COALOIL));
recipes.put(LIGNITE.dust(), new FluidStack(50, Fluids.COALOIL));
recipes.put(KEY_OIL_TAR, new FluidStack(75, Fluids.BITUMEN));
recipes.put(KEY_CRACK_TAR, new FluidStack(100, Fluids.BITUMEN));
recipes.put(KEY_COAL_TAR, new FluidStack(50, Fluids.BITUMEN));
recipes.put(KEY_LOG, new FluidStack(100, Fluids.MUG));
recipes.put(NA.dust(), new FluidStack(100, Fluids.SODIUM));
recipes.put(PB.ingot(), new FluidStack(100, Fluids.LEAD));
recipes.put(PB.dust(), new FluidStack(100, Fluids.LEAD));
//general utility recipes because why not
recipes.put(new ComparableStack(Blocks.netherrack), new FluidStack(250, Fluids.LAVA));
recipes.put(new ComparableStack(Blocks.cobblestone), new FluidStack(250, Fluids.LAVA));
recipes.put(new ComparableStack(Blocks.stone), new FluidStack(250, Fluids.LAVA));
recipes.put(new ComparableStack(Blocks.obsidian), new FluidStack(500, Fluids.LAVA));
recipes.put(new ComparableStack(Items.snowball), new FluidStack(125, Fluids.WATER));
recipes.put(new ComparableStack(Blocks.snow), new FluidStack(500, Fluids.WATER));
recipes.put(new ComparableStack(Blocks.ice), new FluidStack(1000, Fluids.WATER));
recipes.put(new ComparableStack(Blocks.packed_ice), new FluidStack(1000, Fluids.WATER));
recipes.put(new ComparableStack(Items.ender_pearl), new FluidStack(100, Fluids.ENDERJUICE));
recipes.put(new ComparableStack(ModItems.pellet_charged), new FluidStack(4000, Fluids.HELIUM4));
recipes.put(new ComparableStack(ModBlocks.ore_oil_sand), new FluidStack(100, Fluids.BITUMEN));
recipes.put(new ComparableStack(Blocks.netherrack), new FluidStack(250, Fluids.LAVA));
recipes.put(new ComparableStack(Blocks.cobblestone), new FluidStack(250, Fluids.LAVA));
recipes.put(new ComparableStack(Blocks.stone), new FluidStack(250, Fluids.LAVA));
recipes.put(new ComparableStack(Blocks.obsidian), new FluidStack(500, Fluids.LAVA));
recipes.put(new ComparableStack(Items.snowball), new FluidStack(125, Fluids.WATER));
recipes.put(new ComparableStack(Blocks.snow), new FluidStack(500, Fluids.WATER));
recipes.put(new ComparableStack(Blocks.ice), new FluidStack(1000, Fluids.WATER));
recipes.put(new ComparableStack(Blocks.packed_ice), new FluidStack(1000, Fluids.WATER));
recipes.put(new ComparableStack(Items.ender_pearl), new FluidStack(100, Fluids.ENDERJUICE));
recipes.put(new ComparableStack(ModItems.pellet_charged), new FluidStack(4000, Fluids.HELIUM4));
recipes.put(new ComparableStack(ModBlocks.ore_oil_sand), new FluidStack(100, Fluids.BITUMEN));
recipes.put(new ComparableStack(Items.sugar), new FluidStack(100, Fluids.ETHANOL));
recipes.put(new ComparableStack(ModBlocks.plant_flower, 1, 3), new FluidStack(150, Fluids.ETHANOL));
recipes.put(new ComparableStack(ModBlocks.plant_flower, 1, 4), new FluidStack(50, Fluids.ETHANOL));
recipes.put(new ComparableStack(ModItems.biomass), new FluidStack(125, Fluids.BIOGAS));
recipes.put(new ComparableStack(ModItems.glyphid_gland_empty), new FluidStack(2000, Fluids.BIOGAS));
recipes.put(new ComparableStack(Items.sugar), new FluidStack(100, Fluids.ETHANOL));
recipes.put(new ComparableStack(ModBlocks.plant_flower, 1, 3), new FluidStack(150, Fluids.ETHANOL));
recipes.put(new ComparableStack(ModBlocks.plant_flower, 1, 4), new FluidStack(50, Fluids.ETHANOL));
recipes.put(new ComparableStack(ModItems.biomass), new FluidStack(125, Fluids.BIOGAS));
recipes.put(new ComparableStack(ModItems.glyphid_gland_empty), new FluidStack(2000, Fluids.BIOGAS));
recipes.put(new ComparableStack(Items.fish, 1, OreDictionary.WILDCARD_VALUE), new FluidStack(100, Fluids.FISHOIL));
recipes.put(new ComparableStack(Blocks.double_plant, 1, 0), new FluidStack(100, Fluids.SUNFLOWEROIL));
recipes.put(new ComparableStack(Blocks.double_plant, 1, 0), new FluidStack(100, Fluids.SUNFLOWEROIL));
recipes.put(new ComparableStack(Items.wheat_seeds), new FluidStack(50, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Blocks.tallgrass, 1, 1), new FluidStack(100, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Blocks.tallgrass, 1, 2), new FluidStack(100, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Blocks.vine), new FluidStack(100, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Items.wheat_seeds), new FluidStack(50, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Blocks.tallgrass, 1, 1), new FluidStack(100, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Blocks.tallgrass, 1, 2), new FluidStack(100, Fluids.SEEDSLURRY));
recipes.put(new ComparableStack(Blocks.vine), new FluidStack(100, Fluids.SEEDSLURRY));
}
public static FluidStack getOutput(ItemStack stack) {

View File

@ -11,8 +11,10 @@ import com.hbm.inventory.recipes.loader.GenericRecipes.ChanceOutputMulti;
import com.hbm.inventory.recipes.loader.GenericRecipes.IOutput;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemFluidIcon;
import com.hbm.util.BobMathUtil;
import com.hbm.util.i18n.I18nUtil;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
@ -41,12 +43,19 @@ public class GenericRecipe {
public GenericRecipe setIcon(ItemStack icon) { this.icon = icon; this.writeIcon = true; return this; }
public GenericRecipe setIcon(Item item, int meta) { return this.setIcon(new ItemStack(item, 1, meta)); }
public GenericRecipe setIcon(Item item) { return this.setIcon(new ItemStack(item)); }
public GenericRecipe setIcon(Block block) { return this.setIcon(new ItemStack(block)); }
public GenericRecipe setNamed() { this.customLocalization = true; return this; }
public GenericRecipe setInputItems(AStack... input) { this.inputItem = input; return this; }
public GenericRecipe setInputFluids(FluidStack... input) { this.inputFluid = input; return this; }
public GenericRecipe setOutputItems(IOutput... output) { this.outputItem = output; return this; }
public GenericRecipe setOutputFluids(FluidStack... output) { this.outputFluid = output; return this; }
public GenericRecipe inputItems(AStack... input) { this.inputItem = input; return this; }
public GenericRecipe inputFluids(FluidStack... input) { this.inputFluid = input; return this; }
public GenericRecipe outputItems(IOutput... output) { this.outputItem = output; return this; }
public GenericRecipe outputFluids(FluidStack... output) { this.outputFluid = output; return this; }
public GenericRecipe outputItems(ItemStack... output) {
this.outputItem = new IOutput[output.length];
for(int i = 0; i < outputItem.length; i++) this.outputItem[i] = new ChanceOutput(output[i]);
return this;
}
public ItemStack getIcon() {
@ -77,18 +86,21 @@ public class GenericRecipe {
public List<String> print() {
List<String> list = new ArrayList();
list.add(EnumChatFormatting.YELLOW + this.getLocalizedName());
if(duration > 0) list.add(EnumChatFormatting.RED + "Duration: " + this.duration / 20D + "s");
if(power > 0) list.add(EnumChatFormatting.RED + "Consumption: " + BobMathUtil.getShortNumber(power) + "HE/t");
list.add(EnumChatFormatting.BOLD + "Input:");
if(inputItem != null) for(AStack stack : inputItem) {
ItemStack display = stack.extractForCyclingDisplay(20);
list.add(" " + EnumChatFormatting.GRAY + display.stackSize + "x " + display.getDisplayName());
}
if(inputFluid != null) for(FluidStack fluid : inputFluid) list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + (fluid.pressure == 0 ? "" : "at " + EnumChatFormatting.RED + fluid.pressure + " PU"));
if(inputFluid != null) for(FluidStack fluid : inputFluid) list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + (fluid.pressure == 0 ? "" : " at " + EnumChatFormatting.RED + fluid.pressure + " PU"));
list.add(EnumChatFormatting.BOLD + "Output:");
if(outputItem != null) for(IOutput output : outputItem) for(String line : output.getLabel()) list.add(" " + line);
if(outputFluid != null) for(FluidStack fluid : outputFluid) list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + (fluid.pressure == 0 ? "" : "at " + EnumChatFormatting.RED + fluid.pressure + " PU"));
if(outputFluid != null) for(FluidStack fluid : outputFluid) list.add(" " + EnumChatFormatting.BLUE + fluid.fill + "mB " + fluid.type.getLocalizedName() + (fluid.pressure == 0 ? "" : " at " + EnumChatFormatting.RED + fluid.pressure + " PU"));
return list;
}
/** Default impl only matches localized name substring, can be extended to include ingredients as well */
public boolean matchesSearch(String substring) {
return getLocalizedName().toLowerCase(Locale.US).contains(substring.toLowerCase(Locale.US));
}

View File

@ -55,6 +55,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
public void register(T recipe) {
this.recipeOrderedList.add(recipe);
if(recipeNameMap.containsKey(recipe.name)) throw new IllegalStateException("Recipe " + recipe.name + " has been reciped with a duplicate ID!");
this.recipeNameMap.put(recipe.name, recipe);
}
@ -154,8 +155,12 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
/// CLASSES ///
///////////////
public static interface IOutput {
/** true for ChanceOutputMulti with a poolsize >1 */
public boolean possibleMultiOutput();
/** Decides an output, returns a copy of the held result */
public ItemStack collapse();
/** Returns an itemstack only if possibleMultiOutput is false, null otherwise */
public ItemStack getSingle();
public void serialize(JsonWriter writer) throws IOException;
public void deserialize(JsonArray array);
public String[] getLabel();
@ -172,6 +177,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
public ChanceOutput() { super(0); } // for deserialization
public ChanceOutput(ItemStack stack) { this(stack, 1F, 0); }
public ChanceOutput(ItemStack stack, int weight) { this(stack, 1F, weight); }
public ChanceOutput(ItemStack stack, float chance) { this(stack, chance, 0); }
public ChanceOutput(ItemStack stack, float chance, int weight) {
super(weight);
this.stack = stack;
@ -180,10 +186,11 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
@Override
public ItemStack collapse() {
if(this.chance >= 1F) return this.stack;
return RNG.nextFloat() <= chance ? this.stack : null;
if(this.chance >= 1F) return getSingle().copy();
return RNG.nextFloat() <= chance ? getSingle().copy() : null;
}
@Override public ItemStack getSingle() { return this.stack; }
@Override public boolean possibleMultiOutput() { return false; }
@Override
@ -232,6 +239,7 @@ public abstract class GenericRecipes<T extends GenericRecipe> extends Serializab
@Override public ItemStack collapse() { return ((ChanceOutput) WeightedRandom.getRandomItem(RNG, pool)).collapse(); }
@Override public boolean possibleMultiOutput() { return pool.size() > 1; }
@Override public ItemStack getSingle() { return possibleMultiOutput() ? null : pool.get(0).getSingle(); }
@Override
public void serialize(JsonWriter writer) throws IOException {

View File

@ -3,11 +3,13 @@ package com.hbm.module;
import com.hbm.inventory.fluid.tank.FluidTank;
import com.hbm.inventory.recipes.ChemicalPlantRecipes;
import com.hbm.inventory.recipes.loader.GenericRecipe;
import com.hbm.inventory.recipes.loader.GenericRecipes.IOutput;
import api.hbm.energymk2.IEnergyHandlerMK2;
import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
/**
* Option 1: Make a base class with weird arbitrary overrides to define shit like slots for multi machines like the chemfac
@ -17,6 +19,7 @@ import net.minecraft.item.ItemStack;
*/
public class ModuleMachineChemplant {
// setup
public int index;
public IEnergyHandlerMK2 battery;
public ItemStack[] slots;
@ -24,9 +27,12 @@ public class ModuleMachineChemplant {
public int[] outputSlots = new int[3];
public FluidTank[] inputTanks = new FluidTank[3];
public FluidTank[] outputTanks = new FluidTank[3];
// running vars
public String recipe = "null";
public float progress;
// return signals
public boolean didProcess = false;
public boolean markDirty = false;
public ModuleMachineChemplant(int index, IEnergyHandlerMK2 battery, ItemStack[] slots) {
this.index = index;
@ -34,38 +40,128 @@ public class ModuleMachineChemplant {
this.slots = slots;
}
public boolean canProcess() {
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe);
/** Chances tank type and pressure based on recipe */
public void setupTanks(GenericRecipe recipe) {
if(recipe == null) return;
if(recipe.inputFluid != null) for(int i = 0; i < Math.min(inputTanks.length, recipe.inputFluid.length); i++) inputTanks[i].conform(recipe.inputFluid[i]);
if(recipe.outputFluid != null) for(int i = 0; i < Math.min(outputTanks.length, recipe.outputFluid.length); i++) outputTanks[i].conform(recipe.outputFluid[i]);
}
/** Expects the tanks to be set up correctly beforehand */
public boolean canProcess(GenericRecipe recipe) {
if(recipe == null) return false;
if(battery.getPower() < recipe.power) return false;
//TBI
if(recipe.inputItem != null) {
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
if(!recipe.inputItem[i].matchesRecipe(slots[inputSlots[i]], false)) return false;
}
}
if(recipe.inputFluid != null) {
for(int i = 0; i < Math.min(recipe.inputFluid.length, inputTanks.length); i++) {
if(inputTanks[i].getFill() < recipe.inputFluid[i].fill) return false;
}
}
if(recipe.outputItem != null) {
for(int i = 0; i < Math.min(recipe.outputItem.length, outputSlots.length); i++) {
ItemStack stack = slots[outputSlots[i]];
if(stack == null) continue; // always continue if output slot is free
IOutput output = recipe.outputItem[i];
if(output.possibleMultiOutput()) return false; // output slot needs to be empty to decide on multi outputs
ItemStack single = output.getSingle();
if(single == null) return false; // shouldn't be possible but better safe than sorry
if(stack.getItem() != single.getItem()) return false;
if(stack.getItemDamage() != single.getItemDamage()) return false;
if(stack.stackSize + single.stackSize > stack.getMaxStackSize()) return false;
}
}
if(recipe.outputFluid != null) {
for(int i = 0; i < Math.min(recipe.outputFluid.length, outputTanks.length); i++) {
if(recipe.outputFluid[i].fill + outputTanks[i].getFill() > outputTanks[i].getMaxFill()) return false;
}
}
return true;
}
public void resetProgress() { this.progress = 0F; }
public void update() {
//TBI
public void process(GenericRecipe recipe) {
this.battery.setPower(this.battery.getPower() - recipe.power);
float step = Math.min(1F / recipe.duration, 1F); // can't do more than one recipe per tick, might look into that later
this.progress += step;
if(this.progress >= 1F) {
this.progress -= 1F;
if(recipe.inputItem != null) {
for(int i = 0; i < Math.min(recipe.inputItem.length, inputSlots.length); i++) {
slots[inputSlots[i]].stackSize -= recipe.inputItem[i].stacksize;
if(slots[inputSlots[i]].stackSize <= 0) slots[inputSlots[i]] = null;
}
}
if(recipe.inputFluid != null) {
for(int i = 0; i < Math.min(recipe.inputFluid.length, inputTanks.length); i++) {
inputTanks[i].setFill(inputTanks[i].getFill() - recipe.inputFluid[i].fill);
}
}
if(recipe.outputItem != null) {
for(int i = 0; i < Math.min(recipe.outputItem.length, outputSlots.length); i++) {
ItemStack collapse = recipe.outputItem[i].collapse();
if(slots[outputSlots[i]] == null) {
slots[outputSlots[i]] = collapse;
} else {
slots[outputSlots[i]].stackSize += collapse.stackSize; // we can do this because we've already established that the result slot is not null if it's a single output
}
}
}
if(recipe.outputFluid != null) {
for(int i = 0; i < Math.min(recipe.outputFluid.length, outputTanks.length); i++) {
outputTanks[i].setFill(outputTanks[i].getFill() + recipe.outputFluid[i].fill);
}
}
this.markDirty = true;
}
}
public void update() {
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe);
this.setupTanks(recipe);
this.didProcess = false;
this.markDirty = false;
if(this.canProcess(recipe)) {
this.process(recipe);
this.didProcess = true;
} else {
this.progress = 0F;
}
}
/** For item IO, instead of the TE doing all the work it only has to handle non-recipe stuff, the module does the rest */
public boolean isItemValid(int slot, ItemStack stack) {
GenericRecipe recipe = ChemicalPlantRecipes.INSTANCE.recipeNameMap.get(this.recipe);
if(recipe == null) return false;
if(recipe.inputItem == null) return false;
for(int i = 0; i < Math.min(inputSlots.length, recipe.inputItem.length); i++) {
if(recipe.inputItem[i].matchesRecipe(stack, true)) return true;
if(inputSlots[i] == slot && recipe.inputItem[i].matchesRecipe(stack, true)) return true;
}
return false;
}
public ModuleMachineChemplant iInput(int a, int b, int c) { inputSlots[0] = a; inputSlots[1] = b; inputSlots[2] = c; return this; }
public ModuleMachineChemplant iOutput(int a, int b, int c) { outputSlots[0] = a; outputSlots[1] = b; outputSlots[2] = c; return this; }
public ModuleMachineChemplant fInput(FluidTank a, FluidTank b, FluidTank c) { inputTanks[0] = a; inputTanks[1] = b; inputTanks[2] = c; return this; }
public ModuleMachineChemplant fOutput(FluidTank a, FluidTank b, FluidTank c) { outputTanks[0] = a; outputTanks[1] = b; outputTanks[2] = c; return this; }
public ModuleMachineChemplant itemInput(int a, int b, int c) { inputSlots[0] = a; inputSlots[1] = b; inputSlots[2] = c; return this; }
public ModuleMachineChemplant itemOutput(int a, int b, int c) { outputSlots[0] = a; outputSlots[1] = b; outputSlots[2] = c; return this; }
public ModuleMachineChemplant fluidInput(FluidTank a, FluidTank b, FluidTank c) { inputTanks[0] = a; inputTanks[1] = b; inputTanks[2] = c; return this; }
public ModuleMachineChemplant fluidOutput(FluidTank a, FluidTank b, FluidTank c) { outputTanks[0] = a; outputTanks[1] = b; outputTanks[2] = c; return this; }
public void serialize(ByteBuf buf) {
buf.writeFloat(progress);
@ -76,4 +172,14 @@ public class ModuleMachineChemplant {
this.progress = buf.readFloat();
this.recipe = ByteBufUtils.readUTF8String(buf);
}
public void readFromNBT(NBTTagCompound nbt) {
this.progress = nbt.getFloat("progress");
this.recipe = nbt.getString("recipe");
}
public void writeToNBT(NBTTagCompound nbt) {
nbt.setFloat("progress", progress);
nbt.setString("recipe", recipe);
}
}

View File

@ -18,6 +18,7 @@ import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.IUpgradeInfoProvider;
import com.hbm.tileentity.TileEntityMachineBase;
import com.hbm.util.BobMathUtil;
import com.hbm.util.fauxpointtwelve.DirPos;
import com.hbm.util.i18n.I18nUtil;
import api.hbm.energymk2.IEnergyReceiverMK2;
@ -40,6 +41,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
public long power;
public long maxPower = 1_000_000;
public boolean didProcess = false;
public ModuleMachineChemplant chemplantModule;
public UpgradeManagerNT upgradeManager = new UpgradeManagerNT(this);
@ -55,7 +57,10 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
}
this.chemplantModule = new ModuleMachineChemplant(0, this, slots)
.iInput(4, 5, 6).iOutput(7, 8, 9);
.itemInput(4, 5, 6)
.itemOutput(7, 8, 9)
.fluidInput(inputTanks[0], inputTanks[1], inputTanks[2])
.fluidOutput(outputTanks[0], outputTanks[1], outputTanks[2]);
}
@Override
@ -70,6 +75,24 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
this.power = Library.chargeTEFromItems(slots, 0, power, maxPower);
upgradeManager.checkSlots(slots, 2, 3);
inputTanks[0].loadTank(10, 13, slots);
inputTanks[1].loadTank(11, 14, slots);
inputTanks[2].loadTank(12, 15, slots);
outputTanks[0].unloadTank(16, 19, slots);
outputTanks[1].unloadTank(17, 20, slots);
outputTanks[2].unloadTank(18, 21, slots);
for(DirPos pos : getConPos()) {
this.trySubscribe(worldObj, pos);
for(FluidTank tank : inputTanks) if(tank.getTankType() != Fluids.NONE) this.trySubscribe(tank.getTankType(), worldObj, pos);
for(FluidTank tank : outputTanks) if(tank.getFill() > 0) this.tryProvide(tank, worldObj, pos);
}
this.chemplantModule.update();
this.didProcess = this.chemplantModule.didProcess;
if(this.chemplantModule.markDirty) this.markDirty();
this.networkPackNT(100);
@ -77,6 +100,23 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
}
}
public DirPos[] getConPos() {
return new DirPos[] {
new DirPos(xCoord + 2, yCoord, zCoord - 1, Library.POS_X),
new DirPos(xCoord + 2, yCoord, zCoord + 0, Library.POS_X),
new DirPos(xCoord + 2, yCoord, zCoord + 1, Library.POS_X),
new DirPos(xCoord - 2, yCoord, zCoord - 1, Library.NEG_X),
new DirPos(xCoord - 2, yCoord, zCoord + 0, Library.NEG_X),
new DirPos(xCoord - 2, yCoord, zCoord + 1, Library.NEG_X),
new DirPos(xCoord - 1, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord + 0, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord + 1, yCoord, zCoord + 2, Library.POS_Z),
new DirPos(xCoord - 1, yCoord, zCoord - 2, Library.NEG_Z),
new DirPos(xCoord + 0, yCoord, zCoord - 2, Library.NEG_Z),
new DirPos(xCoord + 1, yCoord, zCoord - 2, Library.NEG_Z),
};
}
@Override
public void serialize(ByteBuf buf) {
@ -107,7 +147,7 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
this.outputTanks[i].readFromNBT(nbt, "o" + i);
}
this.chemplantModule.fInput(inputTanks[0], inputTanks[1], inputTanks[2]).fOutput(outputTanks[0], outputTanks[1], outputTanks[2]);
this.chemplantModule.readFromNBT(nbt);
}
@Override
@ -118,12 +158,14 @@ public class TileEntityMachineChemicalPlant extends TileEntityMachineBase implem
this.inputTanks[i].writeToNBT(nbt, "i" + i);
this.outputTanks[i].writeToNBT(nbt, "o" + i);
}
this.chemplantModule.writeToNBT(nbt);
}
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack) {
if(slot == 0) return true; // battery
if(slot >= 2 && slot <= 3 && stack.getItem() instanceof ItemMachineUpgrade) return true; // upgades
if(slot >= 2 && slot <= 3 && stack.getItem() instanceof ItemMachineUpgrade) return true; // upgrades
if(slot >= 10 && slot <= 12) return true; // input fluid
if(slot >= 16 && slot <= 18) return true; // output fluid
if(this.chemplantModule.isItemValid(slot, stack)) return true; // recipe input crap

View File

@ -2871,7 +2871,7 @@ item.plate_euphemium.name=Euphemium-Verbundplatte
item.plate_gold.name=Goldplatte
item.plate_gunmetal.name=Rotgussplatte
item.plate_iron.name=Eisenplatte
item.plate_kevlar.name=Kevlar-Keramik-Verbund
item.plate_kevlar.name=Kevlarplatte
item.plate_lead.name=Bleiplatte
item.plate_mixed.name=Gemischte Platte
item.plate_paa.name=PaA-Legierungsplatte

View File

@ -3766,7 +3766,7 @@ item.plate_fuel_u235.name=HEU-235 Plate Fuel
item.plate_gold.name=Gold Plate
item.plate_gunmetal.name=Gunmetal Plate
item.plate_iron.name=Iron Plate
item.plate_kevlar.name=Kevlar-Ceramic Compound
item.plate_kevlar.name=Kevlar Sheet
item.plate_lead.name=Lead Plate
item.plate_mixed.name=Mixed Plate
item.plate_paa.name=PaA Alloy Plate

Binary file not shown.

Before

Width:  |  Height:  |  Size: 404 B

After

Width:  |  Height:  |  Size: 374 B