mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Rotary Furnace Fuel Tweak
Better fuels speed up the rotary furnace, but require more steam Steam requirements scale with speed nonlinearly, being x^1.5
This commit is contained in:
parent
4972f4023a
commit
89fe899f2a
@ -30,7 +30,9 @@ public class ModuleBurnTime {
|
||||
private static final int modRocket = 6;
|
||||
private static final int modBalefire = 7;
|
||||
|
||||
|
||||
private double[] modTime = new double[8];
|
||||
|
||||
private double[] modHeat = new double[8];
|
||||
|
||||
public ModuleBurnTime() {
|
||||
@ -185,6 +187,13 @@ public class ModuleBurnTime {
|
||||
|
||||
return num;
|
||||
}
|
||||
public double[] getModHeat() {
|
||||
return modHeat;
|
||||
}
|
||||
public double[] getModTime() {
|
||||
return modTime;
|
||||
}
|
||||
|
||||
|
||||
public ModuleBurnTime setLogTimeMod(double mod) { this.modTime[modLog] = mod; return this; }
|
||||
public ModuleBurnTime setWoodTimeMod(double mod) { this.modTime[modWood] = mod; return this; }
|
||||
|
||||
@ -1,7 +1,10 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.handler.pollution.PollutionHandler;
|
||||
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
|
||||
import com.hbm.inventory.RecipesCommon.AStack;
|
||||
@ -16,12 +19,10 @@ import com.hbm.inventory.recipes.RotaryFurnaceRecipes;
|
||||
import com.hbm.inventory.recipes.RotaryFurnaceRecipes.RotaryFurnaceRecipe;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.module.ModuleBurnTime;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.toclient.AuxParticlePacketNT;
|
||||
import com.hbm.tileentity.IConditionalInvAccess;
|
||||
import com.hbm.tileentity.IFluidCopiable;
|
||||
import com.hbm.tileentity.IGUIProvider;
|
||||
import com.hbm.tileentity.TileEntityMachinePolluting;
|
||||
import com.hbm.tileentity.*;
|
||||
import com.hbm.util.CrucibleUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||
@ -41,27 +42,39 @@ import net.minecraft.util.Vec3;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting implements IFluidStandardTransceiver, IGUIProvider, IFluidCopiable, IConditionalInvAccess {
|
||||
public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting implements IFluidStandardTransceiver, IGUIProvider, IFluidCopiable, IConditionalInvAccess, IConfigurableMachine {
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public boolean isProgressing;
|
||||
public float progress;
|
||||
public int burnTime;
|
||||
public int maxBurnTime;
|
||||
public int steamUsed = 0;
|
||||
public boolean isVenting;
|
||||
public MaterialStack output;
|
||||
public ItemStack lastFuel;
|
||||
public static final int maxOutput = MaterialShapes.BLOCK.q(16);
|
||||
|
||||
public int anim;
|
||||
public int lastAnim;
|
||||
|
||||
/**Given this has no heat, the heat mod instead affects the progress per fuel **/
|
||||
public static ModuleBurnTime burnModule = new ModuleBurnTime()
|
||||
.setCokeTimeMod(1.25)
|
||||
.setRocketTimeMod(1.5)
|
||||
.setSolidTimeMod(1.5)
|
||||
.setBalefireTimeMod(1.5)
|
||||
|
||||
.setCokeHeatMod(1.25)
|
||||
.setSolidHeatMod(1.5)
|
||||
.setRocketHeatMod(2.5)
|
||||
.setBalefireHeatMod(10);
|
||||
|
||||
public TileEntityMachineRotaryFurnace() {
|
||||
super(5, 50);
|
||||
tanks = new FluidTank[3];
|
||||
tanks[0] = new FluidTank(Fluids.NONE, 16_000);
|
||||
tanks[1] = new FluidTank(Fluids.STEAM, 4_000);
|
||||
tanks[2] = new FluidTank(Fluids.SPENTSTEAM, 40);
|
||||
tanks[1] = new FluidTank(Fluids.STEAM, 12_000);
|
||||
tanks[2] = new FluidTank(Fluids.SPENTSTEAM, 120);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -117,15 +130,19 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
if(recipe != null) {
|
||||
|
||||
if(this.burnTime <= 0 && slots[4] != null && TileEntityFurnace.isItemFuel(slots[4])) {
|
||||
this.maxBurnTime = this.burnTime = TileEntityFurnace.getItemBurnTime(slots[4]) / 2;
|
||||
lastFuel = slots[4];
|
||||
this.maxBurnTime = this.burnTime = burnModule.getBurnTime(lastFuel) / 2;
|
||||
this.decrStackSize(4, 1);
|
||||
this.markChanged();
|
||||
}
|
||||
|
||||
if(this.canProcess(recipe)) {
|
||||
this.progress += 1F / recipe.duration;
|
||||
tanks[1].setFill(tanks[1].getFill() - recipe.steam);
|
||||
steamUsed += recipe.steam;
|
||||
float speed = Math.max((float) burnModule.getMod(lastFuel, burnModule.getModHeat()), 1);
|
||||
this.progress += speed / recipe.duration;
|
||||
|
||||
speed = (float) Math.pow(speed, 1.5);
|
||||
tanks[1].setFill((int) (tanks[1].getFill() - recipe.steam * speed));
|
||||
tanks[2].setFill((int) (tanks[2].getFill() + recipe.steam * speed / 100));
|
||||
this.isProgressing = true;
|
||||
|
||||
if(this.progress >= 1F) {
|
||||
@ -143,15 +160,6 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
} else {
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
if(this.steamUsed >= 100) {
|
||||
int steamReturn = this.steamUsed / 100;
|
||||
int canReturn = tanks[2].getMaxFill() - tanks[2].getFill();
|
||||
int doesReturn = Math.min(steamReturn, canReturn);
|
||||
this.steamUsed -= doesReturn * 100;
|
||||
tanks[2].setFill(tanks[2].getFill() + doesReturn);
|
||||
}
|
||||
|
||||
} else {
|
||||
this.progress = 0;
|
||||
}
|
||||
@ -187,7 +195,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
}
|
||||
this.lastAnim = this.anim;
|
||||
if(this.isProgressing) {
|
||||
this.anim++;
|
||||
this.anim += (int) Math.max(burnModule.getMod(slots[4], burnModule.getModHeat()), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -239,6 +247,9 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
this.progress = nbt.getFloat("prog");
|
||||
this.burnTime = nbt.getInteger("burn");
|
||||
this.maxBurnTime = nbt.getInteger("maxBurn");
|
||||
ItemStack nbtFuel = ItemStack.loadItemStackFromNBT(nbt.getCompoundTag("lastFuel"));
|
||||
if(nbtFuel != null)
|
||||
this.lastFuel = nbtFuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -250,6 +261,7 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
nbt.setFloat("prog", progress);
|
||||
nbt.setInteger("burn", burnTime);
|
||||
nbt.setInteger("maxBurn", maxBurnTime);
|
||||
nbt.setTag("lastFuel", lastFuel.writeToNBT(new NBTTagCompound()));
|
||||
}
|
||||
|
||||
public DirPos[] getSteamPos() {
|
||||
@ -283,7 +295,6 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
|
||||
if(tanks[1].getFill() < recipe.steam) return false;
|
||||
if(tanks[2].getMaxFill() - tanks[2].getFill() < recipe.steam / 100) return false;
|
||||
if(this.steamUsed > 100) return false;
|
||||
|
||||
if(this.output != null) {
|
||||
if(this.output.material != recipe.output.material) return false;
|
||||
@ -383,4 +394,23 @@ public class TileEntityMachineRotaryFurnace extends TileEntityMachinePolluting i
|
||||
|
||||
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineRotaryFurnace(player.inventory, this); }
|
||||
@Override public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineRotaryFurnace(player.inventory, this); }
|
||||
|
||||
@Override
|
||||
public String getConfigName() {
|
||||
return "rotaryfurnace";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readIfPresent(JsonObject obj) {
|
||||
if(obj.has("burnModule")) {
|
||||
burnModule.readIfPresent(obj.get("M:burnModule").getAsJsonObject());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeConfig(JsonWriter writer) throws IOException {
|
||||
writer.name("M:burnModule").beginObject();
|
||||
burnModule.writeConfig(writer);
|
||||
writer.endObject();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user