pressure requirement for recipes

This commit is contained in:
Boblet 2023-06-23 11:17:37 +02:00
parent ff4b231be2
commit bb15f50047
9 changed files with 41 additions and 28 deletions

View File

@ -10,6 +10,8 @@
* Compressor
* Can compress fluids, turning them into higher pressure variants
* Can also turn steam into higher pressure types
* Vacuum refning now requires oil at 2 PU
* Some chemical plant recipes also require compressed fluid, TATB requires sour gas at 1 PU and osmiridic solution requires hydrogen peroxide at 5 PU
* A new rocket artillery ammo type that creates volcanic lava on impact
* BDCL
* A type of lubricant that is easy to make and can be used in hydraulic piston and electric press recipes instead of regular lubricant

View File

@ -45,7 +45,7 @@ public class ChemplantRecipeHandler extends TemplateRecipeHandler {
for(int i = 0; i < recipe.inputFluids.length; i++) {
FluidStack in = recipe.inputFluids[i];
if(in == null) continue;
ItemStack drop = ItemFluidIcon.make(in.type, in.fill);
ItemStack drop = ItemFluidIcon.make(in);
this.fluidIn[i] = new PositionedStack(drop, 30 + (i % 2) * 18, 6);
}
@ -58,7 +58,7 @@ public class ChemplantRecipeHandler extends TemplateRecipeHandler {
for(int i = 0; i < recipe.outputFluids.length; i++) {
FluidStack out = recipe.outputFluids[i];
if(out == null) continue;
ItemStack drop = ItemFluidIcon.make(out.type, out.fill);
ItemStack drop = ItemFluidIcon.make(out);
this.fluidOut[i] = new PositionedStack(drop, 120 + (i % 2) * 18, 6);
}

View File

@ -241,7 +241,7 @@ public class FluidTank {
list.add(fluid + "/" + maxFluid + "mB");
if(this.pressure != 0) {
list.add(EnumChatFormatting.RED + "" + this.pressure + " PU");
list.add(EnumChatFormatting.RED + "Pressure: " + this.pressure + " PU");
}
type.addInfo(list);

View File

@ -147,7 +147,7 @@ public class ChemplantRecipes extends SerializableRecipe {
.outputItems(new ItemStack(ModItems.ball_tnt, 4)));
recipes.add(new ChemRecipe(95, "TATB", 50)
.inputItems(new ComparableStack(ModItems.ball_tnt))
.inputFluids(new FluidStack(Fluids.SOURGAS, 200), new FluidStack(Fluids.NITRIC_ACID, 10))
.inputFluids(new FluidStack(Fluids.SOURGAS, 200, 1), new FluidStack(Fluids.NITRIC_ACID, 10))
.outputItems(new ItemStack(ModItems.ball_tatb)));
recipes.add(new ChemRecipe(84, "C4", 150)
.inputItems(new OreDictStack(KNO.dust()))
@ -352,7 +352,7 @@ public class ChemplantRecipes extends SerializableRecipe {
new ComparableStack(ModItems.powder_paleogenite),
new OreDictStack(F.dust(), 8),
new ComparableStack(ModItems.nugget_bismuth, 4))
.inputFluids(new FluidStack(Fluids.ACID, 1000))
.inputFluids(new FluidStack(Fluids.ACID, 1000, 5))
.outputFluids(new FluidStack(Fluids.DEATH, 1000)));
//one bucket of ethanol equals 275_000 TU using the diesel baseline0
//the coal baseline is 400_000 per piece

View File

@ -58,7 +58,7 @@ public class RefineryRecipes {
public static HashMap<Object, Object[]> getVacuumRecipe() {
HashMap<Object, Object[]> recipes = new HashMap<Object, Object[]>();
recipes.put(ItemFluidIcon.make(Fluids.OIL, 1000),
recipes.put(ItemFluidIcon.make(Fluids.OIL, 1000, 2),
new ItemStack[] {
ItemFluidIcon.make(Fluids.HEAVYOIL_VACUUM, vac_frac_heavy * 10),
ItemFluidIcon.make(Fluids.REFORMATE, vac_frac_reform * 10),

View File

@ -75,7 +75,8 @@ public class ItemChemistryTemplate extends Item {
for(int i = 0; i < 2; i++) {
if(recipe.outputFluids[i] != null) {
list.add(recipe.outputFluids[i].fill + "mB " + I18n.format(recipe.outputFluids[i].type.getUnlocalizedName()));
int p = recipe.outputFluids[i].pressure;
list.add(recipe.outputFluids[i].fill + "mB " + I18n.format(recipe.outputFluids[i].type.getUnlocalizedName()) + (p != 0 ? (" at " + p + "PU") : ""));
}
}
@ -89,7 +90,8 @@ public class ItemChemistryTemplate extends Item {
for(int i = 0; i < 2; i++) {
if(recipe.inputFluids[i] != null) {
list.add(recipe.inputFluids[i].fill + "mB " + I18n.format(recipe.inputFluids[i].type.getUnlocalizedName()));
int p = recipe.inputFluids[i].pressure;
list.add(recipe.inputFluids[i].fill + "mB " + I18n.format(recipe.inputFluids[i].type.getUnlocalizedName()) + (p != 0 ? (" at " + p + "PU") : ""));
}
}

View File

@ -14,6 +14,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
@ -38,39 +39,47 @@ public class ItemFluidIcon extends Item {
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
if(stack.hasTagCompound()) {
if(stack.getTagCompound().getInteger("fill") > 0)
list.add(stack.getTagCompound().getInteger("fill") + "mB");
if(getQuantity(stack) > 0) list.add(getQuantity(stack) + "mB");
if(getPressure(stack) > 0) list.add(EnumChatFormatting.RED + "" + getPressure(stack) + "PU");
}
Fluids.fromID(stack.getItemDamage()).addInfo(list);
}
public static ItemStack addQuantity(ItemStack stack, int i) {
if(!stack.hasTagCompound())
stack.stackTagCompound = new NBTTagCompound();
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
stack.getTagCompound().setInteger("fill", i);
return stack;
}
public static ItemStack addPressure(ItemStack stack, int i) {
if(!stack.hasTagCompound()) stack.stackTagCompound = new NBTTagCompound();
stack.getTagCompound().setInteger("pressure", i);
return stack;
}
public static ItemStack make(FluidStack stack) {
return make(stack.type, stack.fill);
return make(stack.type, stack.fill, stack.pressure);
}
public static ItemStack make(FluidType fluid, int i) {
return addQuantity(new ItemStack(ModItems.fluid_icon, 1, fluid.ordinal()), i);
return make(fluid, i, 0);
}
public static ItemStack make(FluidType fluid, int i, int pressure) {
return addPressure(addQuantity(new ItemStack(ModItems.fluid_icon, 1, fluid.ordinal()), i), pressure);
}
public static int getQuantity(ItemStack stack) {
if(!stack.hasTagCompound())
return 0;
if(!stack.hasTagCompound()) return 0;
return stack.getTagCompound().getInteger("fill");
}
public static int getPressure(ItemStack stack) {
if(!stack.hasTagCompound()) return 0;
return stack.getTagCompound().getInteger("pressure");
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
String s = (StatCollector.translateToLocal(Fluids.fromID(stack.getItemDamage()).getUnlocalizedName())).trim();

View File

@ -266,10 +266,10 @@ public class TileEntityMachineChemplant extends TileEntityMachineBase implements
}
private void setupTanks(ChemRecipe recipe) {
if(recipe.inputFluids[0] != null) tanks[0].setTankType(recipe.inputFluids[0].type); else tanks[0].setTankType(Fluids.NONE);
if(recipe.inputFluids[1] != null) tanks[1].setTankType(recipe.inputFluids[1].type); else tanks[1].setTankType(Fluids.NONE);
if(recipe.outputFluids[0] != null) tanks[2].setTankType(recipe.outputFluids[0].type); else tanks[2].setTankType(Fluids.NONE);
if(recipe.outputFluids[1] != null) tanks[3].setTankType(recipe.outputFluids[1].type); else tanks[3].setTankType(Fluids.NONE);
if(recipe.inputFluids[0] != null) tanks[0].withPressure(recipe.inputFluids[0].pressure).setTankType(recipe.inputFluids[0].type); else tanks[0].setTankType(Fluids.NONE);
if(recipe.inputFluids[1] != null) tanks[1].withPressure(recipe.inputFluids[1].pressure).setTankType(recipe.inputFluids[1].type); else tanks[1].setTankType(Fluids.NONE);
if(recipe.outputFluids[0] != null) tanks[2].withPressure(recipe.outputFluids[0].pressure).setTankType(recipe.outputFluids[0].type); else tanks[2].setTankType(Fluids.NONE);
if(recipe.outputFluids[1] != null) tanks[3].withPressure(recipe.outputFluids[1].pressure).setTankType(recipe.outputFluids[1].type); else tanks[3].setTankType(Fluids.NONE);
}
private boolean hasRequiredFluids(ChemRecipe recipe) {

View File

@ -109,10 +109,10 @@ public abstract class TileEntityMachineChemplantBase extends TileEntityMachineBa
}
private void setupTanks(ChemRecipe recipe, int index) {
if(recipe.inputFluids[0] != null) tanks[index * 4].setTankType(recipe.inputFluids[0].type);
if(recipe.inputFluids[1] != null) tanks[index * 4 + 1].setTankType(recipe.inputFluids[1].type);
if(recipe.outputFluids[0] != null) tanks[index * 4 + 2].setTankType(recipe.outputFluids[0].type);
if(recipe.outputFluids[1] != null) tanks[index * 4 + 3].setTankType(recipe.outputFluids[1].type);
if(recipe.inputFluids[0] != null) tanks[index * 4].withPressure(recipe.inputFluids[0].pressure).setTankType(recipe.inputFluids[0].type); else tanks[index * 4].setTankType(Fluids.NONE);
if(recipe.inputFluids[1] != null) tanks[index * 4 + 1].withPressure(recipe.inputFluids[1].pressure).setTankType(recipe.inputFluids[1].type); else tanks[index * 4 + 1].setTankType(Fluids.NONE);
if(recipe.outputFluids[0] != null) tanks[index * 4 + 2].withPressure(recipe.outputFluids[0].pressure).setTankType(recipe.outputFluids[0].type); else tanks[index * 4 + 2].setTankType(Fluids.NONE);
if(recipe.outputFluids[1] != null) tanks[index * 4 + 3].withPressure(recipe.outputFluids[1].pressure).setTankType(recipe.outputFluids[1].type); else tanks[index * 4 + 3].setTankType(Fluids.NONE);
}
private boolean hasRequiredFluids(ChemRecipe recipe, int index) {