Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge of Lost Era fork #71

Merged
merged 9 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/main/java/mekanism/api/MekanismConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ public static class generators
{
public static double advancedSolarGeneration;
public static double bioGeneration;
public static int ethanolDuration;

public static int biogasDuration;

public static double ethanolMultiplier;
public static double heatGeneration;
public static double heatGenerationLava;
Expand All @@ -164,7 +168,6 @@ public static class generators
public static int condenserRate;
public static boolean enableWindmillWhitelist;
public static List<String> winddimensionids;

}

public static class tools
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/mekanism/client/gui/GuiMekanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import mekanism.common.tile.TileEntityContainerBlock;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
Expand Down Expand Up @@ -285,4 +286,9 @@ protected FontRenderer getFontRenderer()
{
return fontRendererObj;
}

public boolean canInteractWith(EntityPlayer entityPlayer)
{
return tileEntity.isUseableByPlayer(entityPlayer);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,11 @@ else if(gasType == GasRegistry.getGas("hydrogenChloride"))

return fuels;
}
else if(gasType == GasRegistry.getGas("glucose"))
else if(gasType == GasRegistry.getGas("molasse"))
{
List<ItemStack> fuels = new ArrayList<ItemStack>();
fuels.addAll(OreDictionary.getOres("dustSugar"));

for(GasTankTier tier : GasTankTier.values())
{
fuels.add(MekanismUtils.getFullGasTank(tier, GasRegistry.getGas("glucose")));
}

return fuels;
}

Expand Down
8 changes: 4 additions & 4 deletions src/main/java/mekanism/client/render/MekanismRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class MekanismRenderer

public static IIcon energyIcon;

public static IIcon biomatterIcon;
public static IIcon biomassIcon;
public static IIcon ethanolIcon;

public static IIcon heatIcon;
Expand Down Expand Up @@ -102,7 +102,7 @@ public void onStitch(TextureStitchEvent.Pre event)
heatIcon = event.map.registerIcon("mekanism:liquid/LiquidHeat");

ethanolIcon = event.map.registerIcon("mekanism:liquid/LiquidEthanol");
biomatterIcon = event.map.registerIcon("mekanism:liquid/LiquidBiomatter");
biomassIcon = event.map.registerIcon("mekanism:liquid/LiquidBiomass");


GasRegistry.getGas("hydrogen").setIcon(event.map.registerIcon("mekanism:liquid/LiquidHydrogen"));
Expand All @@ -123,9 +123,9 @@ public void onStitch(TextureStitchEvent.Pre event)
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("glucose").setIcon(event.map.registerIcon("mekanism:liquid/LiquidGlucose"));
GasRegistry.getGas("molasse").setIcon(event.map.registerIcon("mekanism:liquid/LiquidMolasse"));

GasRegistry.getGas("biomatter").setIcon(biomatterIcon);
GasRegistry.getGas("biomass").setIcon(biomassIcon);
GasRegistry.getGas("bioethanol").setIcon(ethanolIcon);


Expand Down
10 changes: 5 additions & 5 deletions src/main/java/mekanism/common/Mekanism.java
Original file line number Diff line number Diff line change
Expand Up @@ -1099,7 +1099,7 @@ public void addRecipes()
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Blocks.hardened_clay), "water", new ItemStack(Blocks.clay));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.brick), "water", new ItemStack(Items.clay_ball));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(Items.gunpowder), "hydrogenChloride", new ItemStack(MekanismItems.OtherDust, 1, 3));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(MekanismItems.Yeast), "glucose", new ItemStack(MekanismItems.Yeast, 3));
RecipeHandler.addChemicalInjectionChamberRecipe(new ItemStack(MekanismItems.Yeast), "molasse", new ItemStack(MekanismItems.Yeast, 3));

//Precision Sawmill Recipes
RecipeHandler.addPrecisionSawmillRecipe(new ItemStack(Blocks.ladder, 3), new ItemStack(Items.stick, 7));
Expand Down Expand Up @@ -1169,7 +1169,7 @@ public void addRecipes()
//Pressurized Reaction Chamber Recipes

RecipeHandler.addPRCRecipe(
new ItemStack(MekanismItems.Yeast), new FluidStack(FluidRegistry.WATER, 200), new GasStack(GasRegistry.getGas("biomatter"), 150),
new ItemStack(MekanismItems.Yeast), new FluidStack(FluidRegistry.WATER, 200), new GasStack(GasRegistry.getGas("biomass"), 150),
new ItemStack(MekanismItems.Substrate), new GasStack(GasRegistry.getGas("bioethanol"), 50),
100,
50);
Expand Down Expand Up @@ -1207,7 +1207,7 @@ public void addRecipes()
}

//Chemical Oxidiser Recipes
RecipeHandler.addChemicalOxidizerRecipe(new ItemStack(MekanismItems.BioFuel), new GasStack(GasRegistry.getGas("biomatter"), 150));
RecipeHandler.addChemicalOxidizerRecipe(new ItemStack(MekanismItems.BioFuel), new GasStack(GasRegistry.getGas("biomass"), 100));

//Fuels
GameRegistry.registerFuelHandler(new IFuelHandler() {
Expand Down Expand Up @@ -1430,9 +1430,9 @@ public void preInit(FMLPreInitializationEvent event)
GasRegistry.register(new Gas("fusionFuelDT")).registerFluid();
GasRegistry.register(new Gas("lithium")).registerFluid();
GasRegistry.register(new Gas("methane")).registerFluid();
GasRegistry.register(new Gas("biomatter")).registerFluid();
GasRegistry.register(new Gas("biomass")).registerFluid();
GasRegistry.register(new Gas("bioethanol")).registerFluid();
GasRegistry.register(new Gas("glucose")).registerFluid();
GasRegistry.register(new Gas("molasse").setVisible(false));

FluidRegistry.registerFluid(new Fluid("heavyWater"));
FluidRegistry.registerFluid(new Fluid("steam").setGaseous(true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public GasStack getItemGas(ItemStack itemstack)
{
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") || MekanismUtils.getOreDictName(itemstack).contains("listAllSugar")) return new GasStack(GasRegistry.getGas("glucose"), 90);
if(MekanismUtils.getOreDictName(itemstack).contains("dustSugar") || MekanismUtils.getOreDictName(itemstack).contains("listAllSugar")) return new GasStack(GasRegistry.getGas("molasse"), 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);

Expand Down Expand Up @@ -102,7 +102,7 @@ public boolean canTubeConnect(ForgeDirection side)
@Override
public boolean isValidGas(Gas gas)
{
return gas == GasRegistry.getGas("sulfuricAcid") || gas == GasRegistry.getGas("water") || gas == GasRegistry.getGas("hydrogenChloride")|| gas == GasRegistry.getGas("glucose");
return gas == GasRegistry.getGas("sulfuricAcid") || gas == GasRegistry.getGas("water") || gas == GasRegistry.getGas("hydrogenChloride")|| gas == GasRegistry.getGas("molasse");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ public void setInventorySlotContents(int slotID, ItemStack itemstack)
@Override
public boolean isUseableByPlayer(EntityPlayer entityplayer)
{
return !isInvalid();
if (isInvalid())
return false;

return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && entityplayer.getDistanceSq(this.xCoord + 0.5, this.yCoord + 0.5, this.zCoord +0.5) < 64;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private DisplayInteger[] getDisplayList(int gasType, ForgeDirection side)
if (gasType == 1)
model3D.setTexture(MekanismRenderer.ethanolIcon);
else
model3D.setTexture(MekanismRenderer.biomatterIcon);
model3D.setTexture(MekanismRenderer.biomassIcon);

for(int i = 0; i < stages; i++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,9 @@ public void loadConfiguration()
{
generators.advancedSolarGeneration = Mekanism.configurationgenerators.get("generation", "AdvancedSolarGeneration", 300D).getDouble();
generators.bioGeneration = Mekanism.configurationgenerators.get("generation", "BioGeneration", 100D).getDouble();
generators.ethanolMultiplier = Mekanism.configurationgenerators.get("generation", "EthanolMultiplier", 5D).getDouble();
generators.biogasDuration = Mekanism.configurationgenerators.get("generation", "BiogasDuration", 1).getInt();
generators.ethanolDuration = Mekanism.configurationgenerators.get("generation", "EthanolDuration", 2).getInt();
generators.ethanolMultiplier = Mekanism.configurationgenerators.get("generation", "EthanolMultiplier", 3D).getDouble();
generators.heatGeneration = Mekanism.configurationgenerators.get("generation", "HeatGeneration", 150D).getDouble();
generators.heatGenerationLava = Mekanism.configurationgenerators.get("generation", "HeatGenerationLava", 5D).getDouble();
generators.heatGenerationNether = Mekanism.configurationgenerators.get("generation", "HeatGenerationNether", 100D).getDouble();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ public void writeConfig(ByteBuf dataStream) throws IOException
{
dataStream.writeDouble(generators.advancedSolarGeneration);
dataStream.writeDouble(generators.bioGeneration);
dataStream.writeInt(generators.biogasDuration);
dataStream.writeInt(generators.ethanolDuration);
dataStream.writeDouble(generators.ethanolMultiplier);
dataStream.writeDouble(generators.heatGeneration);
dataStream.writeDouble(generators.heatGenerationLava);
Expand Down Expand Up @@ -312,6 +314,8 @@ public void readConfig(ByteBuf dataStream) throws IOException
{
generators.advancedSolarGeneration = dataStream.readDouble();
generators.bioGeneration = dataStream.readDouble();
generators.biogasDuration = dataStream.readInt();
generators.ethanolDuration = dataStream.readInt();
generators.ethanolMultiplier = dataStream.readDouble();
generators.heatGeneration = dataStream.readDouble();
generators.heatGenerationLava = dataStream.readDouble();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IGasH
{
/** The maximum amount of gas this block can store. */
public int MAX_GAS = 18000;
public int gasDuration;


public GasTank fuelTank;


Expand Down Expand Up @@ -76,16 +79,20 @@ else if(inventory[0] != null && inventory[0].getItem() instanceof IGasItem)
output = generators.bioGeneration * getMultiplier(fuelTank.getGas().getGas()) * 2;

setEnergy(electricityStored + generators.bioGeneration * getMultiplier(fuelTank.getGas().getGas()));
fuelTank.setGas(new GasStack(fuelTank.getGasType(), fuelTank.getStored() - 1));

if (gasDuration <= 0) {
fuelTank.setGas(new GasStack(fuelTank.getGasType(), fuelTank.getStored() - 1));
gasDuration = (fuelTank.getGas().getGas() == GasRegistry.getGas("bioethanol")) ? generators.ethanolDuration : generators.biogasDuration;
} else gasDuration--;
} else {
//reset
output = generators.bioGeneration * 2;

if (fuelTank.getStored() == 0)
fuelTank.setGas(null);
output = generators.bioGeneration * 2;

if (!worldObj.isRemote) {
if (!worldObj.isRemote)
setActive(false);
}
}
}
}
Expand Down Expand Up @@ -123,7 +130,7 @@ else if(slotID == 0)
@Override
public boolean canOperate()
{
return electricityStored < BASE_MAX_ENERGY && fuelTank.getStored() > 0 && MekanismUtils.canFunction(this);
return electricityStored < BASE_MAX_ENERGY && MekanismUtils.canFunction(this);
}

@Override
Expand Down Expand Up @@ -168,7 +175,6 @@ public int getFuelType()
if (fuelTank.getStored() > 0) {

Gas gas = fuelTank.getGas().getGas();

if (gas != null && isValidGas(gas)) {
if (gas == GasRegistry.getGas("bioethanol"))
return 1; //Ethanol
Expand Down Expand Up @@ -223,7 +229,7 @@ public void handlePacketData(ByteBuf dataStream)

public boolean isValidGas(Gas gas)
{
if (gas == GasRegistry.getGas("biomatter") || gas == GasRegistry.getGas("bioethanol")){
if (gas == GasRegistry.getGas("biomass") || gas == GasRegistry.getGas("bioethanol")){
return true;}
else
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/assets/mekanism/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,9 @@ gas.tritium=Tritium
gas.lithium=Lithium
gas.fusionFuelDT=D-T Fuel
gas.methane=Methane
gas.biomatter=BioGas
gas.biomass=BioGas
gas.bioethanol=Ethanol Vapor
gas.glucose=Glucose
gas.molasse=Molasse

gas.iron=Iron Slurry
gas.gold=Gold Slurry
Expand Down Expand Up @@ -350,9 +350,9 @@ fluid.deuterium=Liquid Deuterium
fluid.tritium=Liquid Tritium
fluid.fusionFuelDT=Liquid D-T Fuel
fluid.steam=Steam
fluid.biomatter=Liquid BioGas
fluid.biomass=Biomatter
fluid.bioethanol=Ethanol
fluid.glucose=Liquid Glucose
fluid.molasse=Liquid Molasse


//OreGas names
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"authorList": ["aidancbrady"],
"credits": "Thanks to everyone who has contributed to this ongoing project.",
"logoFile": "logo.png",
"screenshots": []
"screenshots": [],
"dependencies": ["ForgeMultipart"]
},
{
Expand Down