Bio-Generator Refactor

Bio-Generator changes visual depending on fuel type.
Injection Chamber takes more sugar equivalent items based on oredict.
Changed names of Biofuel -> Biomass and Bio-Matter -> BioGas.
Increased saturation of the Ethanol texture.

Rebalanced values of recipes and energy generation.
This commit is contained in:
DrParadox7 committed 2022-11-11 15:29:41 +01:00
1 parent d421edc04d
commit dc1f650c45
10 files changed
+97 -50

No files matched your search

@@ -58,6 +58,10 @@ public class MekanismRenderer
public static IIcon[] colors = new IIcon[256];
public static IIcon energyIcon;
public static IIcon biomatterIcon;
public static IIcon ethanolIcon;
public static IIcon heatIcon;
public static float GAS_RENDER_BASE = 0.2F;
@@ -96,7 +100,11 @@ public class MekanismRenderer
energyIcon = event.map.registerIcon("mekanism:liquid/LiquidEnergy");
heatIcon = event.map.registerIcon("mekanism:liquid/LiquidHeat");
ethanolIcon = event.map.registerIcon("mekanism:liquid/LiquidEthanol");
biomatterIcon = event.map.registerIcon("mekanism:liquid/LiquidBiomatter");
GasRegistry.getGas("hydrogen").setIcon(event.map.registerIcon("mekanism:liquid/LiquidHydrogen"));
GasRegistry.getGas("oxygen").setIcon(event.map.registerIcon("mekanism:liquid/LiquidOxygen"));
GasRegistry.getGas("water").setIcon(event.map.registerIcon("mekanism:liquid/LiquidSteam"));
@@ -115,10 +123,11 @@ public class MekanismRenderer
GasRegistry.getGas("fusionFuelDT").setIcon(event.map.registerIcon("mekanism:liquid/LiquidDT"));
GasRegistry.getGas("lithium").setIcon(event.map.registerIcon("mekanism:liquid/LiquidLithium"));
GasRegistry.getGas("methane").setIcon(event.map.registerIcon("mekanism:liquid/LiquidMethane"));
GasRegistry.getGas("biomatter").setIcon(event.map.registerIcon("mekanism:liquid/LiquidBiomatter"));
GasRegistry.getGas("bioethanol").setIcon(event.map.registerIcon("mekanism:liquid/LiquidEthanol"));
GasRegistry.getGas("glucose").setIcon(event.map.registerIcon("mekanism:liquid/LiquidGlucose"));
GasRegistry.getGas("biomatter").setIcon(biomatterIcon);
GasRegistry.getGas("bioethanol").setIcon(ethanolIcon);
for(Gas gas : GasRegistry.getRegisteredGasses())
{
+7 -7
View File
@@ -1151,7 +1151,7 @@ public class Mekanism
//Thermal Evaporation Plant Recipes
RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("water", 10), FluidRegistry.getFluidStack("brine", 1));
RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("brine", 10), FluidRegistry.getFluidStack("lithium", 1));
RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("bioethanol", 10), FluidRegistry.getFluidStack("ethene", 1)); //Rebalance values
RecipeHandler.addThermalEvaporationRecipe(FluidRegistry.getFluidStack("bioethanol", 5), FluidRegistry.getFluidStack("ethene", 1));
//Chemical Crystallizer Recipes
RecipeHandler.addChemicalCrystallizerRecipe(new GasStack(GasRegistry.getGas("lithium"), 100), new ItemStack(MekanismItems.OtherDust, 1, 4));
@@ -1171,11 +1171,11 @@ public class Mekanism
//Pressurized Reaction Chamber Recipes
RecipeHandler.addPRCRecipe( //Adjust values for balance
new ItemStack(MekanismItems.Yeast), new FluidStack(FluidRegistry.getFluid("steam"), 50), new GasStack(GasRegistry.getGas("biomatter"), 100),
new ItemStack(MekanismItems.Substrate), new GasStack(GasRegistry.getGas("bioethanol"), 100),
1000,
100);
RecipeHandler.addPRCRecipe(
new ItemStack(MekanismItems.Yeast), new FluidStack(FluidRegistry.WATER, 200), new GasStack(GasRegistry.getGas("biomatter"), 150),
new ItemStack(MekanismItems.Substrate), new GasStack(GasRegistry.getGas("bioethanol"), 50),
100,
50);
RecipeHandler.addPRCRecipe(
new ItemStack(MekanismItems.Substrate), new FluidStack(FluidRegistry.getFluid("ethene"), 50), new GasStack(GasRegistry.getGas("oxygen"), 10),
@@ -1210,7 +1210,7 @@ public class Mekanism
}
//Chemical Oxidiser Recipes
RecipeHandler.addChemicalOxidizerRecipe(new ItemStack(MekanismItems.BioFuel), new GasStack(GasRegistry.getGas("biomatter"), 100));
RecipeHandler.addChemicalOxidizerRecipe(new ItemStack(MekanismItems.BioFuel), new GasStack(GasRegistry.getGas("biomatter"), 150));
//Fuels
GameRegistry.registerFuelHandler(new IFuelHandler() {
@@ -45,7 +45,7 @@ public class TileEntityChemicalInjectionChamber extends TileEntityAdvancedElectr
{
if(MekanismUtils.getOreDictName(itemstack).contains("dustSulfur")) return new GasStack(GasRegistry.getGas("sulfuricAcid"), 2);
if(MekanismUtils.getOreDictName(itemstack).contains("dustSalt")) return new GasStack(GasRegistry.getGas("hydrogenChloride"), 2);
if(MekanismUtils.getOreDictName(itemstack).contains("dustSugar")) return new GasStack(GasRegistry.getGas("glucose"), 2);
if(MekanismUtils.getOreDictName(itemstack).contains("dustSugar") || MekanismUtils.getOreDictName(itemstack).contains("listAllSugar")) return new GasStack(GasRegistry.getGas("glucose"), 90);
if(Block.getBlockFromItem(itemstack.getItem()) == MekanismBlocks.GasTank && ((IGasItem)itemstack.getItem()).getGas(itemstack) != null &&
isValidGas(((IGasItem)itemstack.getItem()).getGas(itemstack).getGas())) return new GasStack(GasRegistry.getGas("sulfuricAcid"), 1);
@@ -42,7 +42,7 @@ public class GuiBioGenerator extends GuiMekanism
public List<String> getInfo()
{
return ListUtils.asList(
LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.isActive ? generators.bioGeneration : 0) + "/t",
LangUtils.localize("gui.producing") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.isActive ? generators.bioGeneration * tileEntity.getMultiplier(tileEntity.fuelTank.getGasType()): 0) + "/t",
LangUtils.localize("gui.maxOutput") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t");
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiBioGenerator.png")));
@@ -56,11 +56,16 @@ public class GuiBioGenerator extends GuiMekanism
{
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
boolean isEthanol = tileEntity.getFuelType() == 1;
String bioFuel = isEthanol ? "gui.bioGenerator.bioEthanol" : "gui.bioGenerator.bioGas";
int colorFuel = isEthanol ? 0xFF8622 : 0x00CD00;
fontRendererObj.drawString(tileEntity.getInventoryName(), 45, 6, 0x404040);
fontRendererObj.drawString(LangUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, 0x00CD00);
fontRendererObj.drawString(LangUtils.localize("gui.bioGenerator.bioFuel") + ": " + tileEntity.fuelTank.getStored(), 51, 35, 0x00CD00);
fontRendererObj.drawString(LangUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, 0x00CD00);
fontRendererObj.drawString(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), 51, 26, colorFuel);
fontRendererObj.drawString(LangUtils.localize(bioFuel) + ": " + tileEntity.fuelTank.getStored(), 51, 35, colorFuel);
fontRendererObj.drawString(LangUtils.localize("gui.out") + ": " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxOutput()) + "/t", 51, 44, colorFuel);
}
@Override
@@ -75,7 +80,10 @@ public class GuiBioGenerator extends GuiMekanism
int displayInt;
displayInt = tileEntity.getScaledFuelLevel(52);
drawTexturedModalRect(guiWidth + 7, guiHeight + 17 + 52 - displayInt, 176, 52 + 52 - displayInt, 4, displayInt);
int gasType = tileEntity.getFuelType() * 4;
drawTexturedModalRect(guiWidth + 7, guiHeight + 17 + 52 - displayInt, 176 + gasType, 52 + 52 - displayInt, 4, displayInt);
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
}
@@ -13,6 +13,7 @@ import mekanism.generators.common.tile.TileEntityBioGenerator;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
@@ -41,10 +42,12 @@ public class RenderBioGenerator extends TileEntitySpecialRenderer
{
push();
int gasType = tileEntity.getFuelType();
MekanismRenderer.glowOn();
GL11.glTranslatef((float)x, (float)y, (float)z);
bindTexture(MekanismRenderer.getBlocksTexture());
getDisplayList(ForgeDirection.getOrientation(tileEntity.facing))[tileEntity.getScaledFuelLevel(stages-1)].render();
getDisplayList(gasType, ForgeDirection.getOrientation(tileEntity.facing)) [tileEntity.getScaledFuelLevel(stages-1)].render();
MekanismRenderer.glowOff();
pop();
@@ -68,7 +71,7 @@ public class RenderBioGenerator extends TileEntitySpecialRenderer
}
@SuppressWarnings("incomplete-switch")
private DisplayInteger[] getDisplayList(ForgeDirection side)
private DisplayInteger[] getDisplayList(int gasType, ForgeDirection side)
{
if(energyDisplays.containsKey(side))
{
@@ -79,7 +82,11 @@ public class RenderBioGenerator extends TileEntitySpecialRenderer
Model3D model3D = new Model3D();
model3D.baseBlock = Blocks.water;
model3D.setTexture(MekanismRenderer.energyIcon);
if (gasType == 1)
model3D.setTexture(MekanismRenderer.ethanolIcon);
else
model3D.setTexture(MekanismRenderer.biomatterIcon);
for(int i = 0; i < stages; i++)
{
@@ -100,7 +100,7 @@ public class GeneratorsCommonProxy implements IGuiProvider
public void loadConfiguration()
{
generators.advancedSolarGeneration = Mekanism.configurationgenerators.get("generation", "AdvancedSolarGeneration", 300D).getDouble();
generators.bioGeneration = Mekanism.configurationgenerators.get("generation", "BioGeneration", 350D).getDouble();
generators.bioGeneration = Mekanism.configurationgenerators.get("generation", "BioGeneration", 100D).getDouble();
generators.ethanolMultiplier = Mekanism.configurationgenerators.get("generation", "EthanolMultiplier", 5D).getDouble();
generators.heatGeneration = Mekanism.configurationgenerators.get("generation", "HeatGeneration", 150D).getDouble();
generators.heatGenerationLava = Mekanism.configurationgenerators.get("generation", "HeatGenerationLava", 5D).getDouble();
@@ -6,6 +6,7 @@ import java.util.ArrayList;
import mekanism.api.MekanismConfig.generators;
import mekanism.api.gas.*;
import mekanism.api.gas.GasTank;
import mekanism.common.base.ISustainedData;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.MekanismUtils;
@@ -22,7 +23,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
public TileEntityBioGenerator()
{
super("bio", "BioGenerator", 180000, generators.bioGeneration * Math.max(1+generators.ethanolMultiplier, 2));
super("bio", "BioGenerator", 180000, generators.bioGeneration * generators.ethanolMultiplier * 2);
inventory = new ItemStack[2];
fuelTank = new GasTank(MAX_GAS);
}
@@ -37,17 +38,25 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
//Has valid item and capacity for new gas
if (inventory[0] != null && fuelTank.getStored() < MAX_GAS) {
Gas gasType = null;
//Ensures to only accept currently stored gas
if (fuelTank.getGas() != null) {
if (fuelTank.getStored() > 0 && fuelTank.getGas() != null)
{
gasType = fuelTank.getGas().getGas();
} //If tank has no valid gas in storage, accept gas from container
else if (inventory[0] != null && inventory[0].getItem() instanceof IGasItem) {
if (((IGasItem) inventory[0].getItem()).getGas(inventory[0]) != null) {
gasType = ((IGasItem) inventory[0].getItem()).getGas(inventory[0]).getGas();
}
else if(inventory[0] != null && inventory[0].getItem() instanceof IGasItem)
{
GasStack gas = ((IGasItem)inventory[0].getItem()).getGas(inventory[0]);
//If tank has valid gas in storage, accept gas from container
if(gas != null && isValidGas(gas.getGas()))
{
gasType = gas.getGas();
}
}
//If valid gas, drain Gas container
if (isValidGas(gasType)) {
GasStack removed = GasTransmission.removeGas(inventory[0], gasType, fuelTank.getNeeded());
boolean isTankEmpty = (fuelTank.getGas() == null);
@@ -60,23 +69,20 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
}
}
if (canOperate() && getEnergy() + generators.bioGeneration < getMaxEnergy()) {
if (canOperate()) {
if (!worldObj.isRemote) {
setActive(true);
}
output = generators.bioGeneration * getMultiplier(fuelTank.getGas().getGas()) * 2;
Gas fuel;
//Get multiplier from fuel in tank
fuel = fuelTank.getGas().getGas();
output = generators.bioGeneration * getMultiplier(fuel) * 2;
setEnergy(electricityStored + generators.bioGeneration);
setEnergy(electricityStored + generators.bioGeneration * getMultiplier(fuelTank.getGas().getGas()));
fuelTank.setGas(new GasStack(fuelTank.getGasType(), fuelTank.getStored() - 1));
} else {
//reset
fuelTank.setGas(null);
output = generators.bioGeneration * 2;
if (!worldObj.isRemote) {
setActive(false);
}
@@ -135,6 +141,9 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
boolean isTankEmpty = (fuelTank.getGas() == null);
Gas fuel = (isTankEmpty) ? null : fuelTank.getGas().getGas();
if (fuel != null)
output = generators.bioGeneration * getMultiplier(fuelTank.getGas().getGas()) * 2;
}
@Override
@@ -147,22 +156,25 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
public double getMultiplier(Gas gas)
{
if (gas == GasRegistry.getGas("biomatter")) {
return 1;
} else if(gas == GasRegistry.getGas("bioethanol"))
{
if (gas == GasRegistry.getGas("bioethanol")) {
return generators.ethanolMultiplier;
}
return 0;
return 1;
}
public int getGasStyle()
public int getFuelType()
{
if(fuelTank.getGas().getGas() == GasRegistry.getGas("bioethanol"))
{
return 1; //Orange
if (fuelTank.getStored() > 0) {
Gas gas = fuelTank.getGas().getGas();
if (gas != null && isValidGas(gas)) {
if (gas == GasRegistry.getGas("bioethanol"))
return 1; //Ethanol
}
}
return 0; //Green
return 0; //Biogas
}
public int getTypeGas()
@@ -211,7 +223,10 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
public boolean isValidGas(Gas gas)
{
return gas == GasRegistry.getGas("biomatter") || gas == GasRegistry.getGas("bioethanol");
if (gas == GasRegistry.getGas("biomatter") || gas == GasRegistry.getGas("bioethanol")){
return true;}
else
return false;
}
@Override
@@ -334,7 +349,12 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
boolean isTankEmpty = (fuelTank.getGas() == null);
//Update energy output based on any existing fuel in tank
Gas fuel = (isTankEmpty) ? null : fuelTank.getGas().getGas();
if (fuel != null)
output = generators.bioGeneration * getMultiplier(fuelTank.getGas().getGas()) * 2;
}
}
}