mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-21 20:42:35 +00:00
First draft of Engines producing RF. Compiles. Untested.
This commit is contained in:
1 parent
b786a227ed
commit
1080799a8d
8 files changed
+110
-126
No files matched your search
@@ -109,10 +109,6 @@ public class Config {
|
||||
public static HashMap<String, String[]> hints = new HashMap<String, String[]>();
|
||||
public static boolean disableEnergyStat = false;
|
||||
|
||||
// Power rations
|
||||
public static double MJ_RF_Ratio = 10;
|
||||
public static double MJ_EU_Ratio = 2.5;
|
||||
|
||||
@SuppressWarnings({ "all" })
|
||||
public static void load() {
|
||||
|
||||
@@ -255,8 +251,6 @@ public class Config {
|
||||
for (String str : disabledStructures)
|
||||
Proxies.log.finer("Disabled structure '%s'.", str);
|
||||
|
||||
Config.MJ_RF_Ratio = Double.parseDouble(config.get("MJ_RF_Ratio", CATEGORY_COMMON, 10F).Value);
|
||||
Config.MJ_EU_Ratio = Double.parseDouble(config.get("MJ_EU_Ratio", CATEGORY_COMMON, 2.5F).Value);
|
||||
registerClimates();
|
||||
ForestryTrigger.initialize();
|
||||
|
||||
|
||||
@@ -201,8 +201,8 @@ public class Defaults {
|
||||
public static final int ENGINE_COPPER_ASH_FOR_ITEM = 7500;
|
||||
|
||||
public static final int ENGINE_TIN_HEAT_MAX = 3000;
|
||||
public static final int ENGINE_TIN_EU_FOR_CYCLE = 6;
|
||||
public static final int ENGINE_TIN_ENERGY_PER_CYCLE = 2;
|
||||
public static final int ENGINE_TIN_EU_FOR_CYCLE = 5; //Reduced from 6 to 5, as per the 4 RF to 1 EU ratio
|
||||
public static final int ENGINE_TIN_ENERGY_PER_CYCLE = 20;
|
||||
public static final int ENGINE_TIN_MAX_EU_STORED = 2 * ENGINE_TIN_EU_FOR_CYCLE;
|
||||
public static final int ENGINE_TIN_MAX_EU_BATTERY = 100;
|
||||
|
||||
|
||||
@@ -20,14 +20,8 @@ import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import buildcraft.api.core.Position;
|
||||
import buildcraft.api.power.IPowerEmitter;
|
||||
import buildcraft.api.power.IPowerReceptor;
|
||||
import buildcraft.api.power.PowerHandler;
|
||||
import buildcraft.api.power.PowerHandler.PowerReceiver;
|
||||
import buildcraft.api.transport.IPipeConnection;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
||||
import cofh.api.energy.EnergyStorage;
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import forestry.core.TemperatureState;
|
||||
import forestry.core.config.Defaults;
|
||||
import forestry.core.interfaces.IPowerHandler;
|
||||
@@ -36,7 +30,7 @@ import forestry.core.proxy.Proxies;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.plugins.PluginBuildCraft;
|
||||
|
||||
public abstract class Engine extends TileBase implements IPowerHandler, IPipeConnection, IPowerEmitter {
|
||||
public abstract class Engine extends TileBase implements IEnergyHandler {
|
||||
|
||||
@Override
|
||||
public PacketPayload getPacketPayload() {
|
||||
@@ -46,7 +40,7 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
payload.intPayload[0] = 1;
|
||||
else
|
||||
payload.intPayload[0] = 0;
|
||||
payload.intPayload[1] = (int) storedEnergy;
|
||||
payload.intPayload[1] = energyStorage.getEnergyStored();
|
||||
payload.intPayload[2] = heat;
|
||||
|
||||
payload.floatPayload[0] = pistonSpeedServer;
|
||||
@@ -56,11 +50,8 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
@Override
|
||||
public void fromPacketPayload(PacketPayload payload) {
|
||||
|
||||
if (payload.intPayload[0] > 0)
|
||||
isActive = true;
|
||||
else
|
||||
isActive = false;
|
||||
storedEnergy = payload.intPayload[1];
|
||||
isActive = payload.intPayload[0] > 0;
|
||||
energyStorage.setEnergyStored(payload.intPayload[1]);
|
||||
heat = payload.intPayload[2];
|
||||
|
||||
pistonSpeedServer = payload.floatPayload[0];
|
||||
@@ -78,19 +69,19 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
protected int currentOutput = 0;
|
||||
public final int maxEnergy;
|
||||
public final int maxEnergyExtracted;
|
||||
public float storedEnergy;
|
||||
public int heat;
|
||||
protected final int maxHeat;
|
||||
protected boolean forceCooldown = false;
|
||||
public float progress;
|
||||
private final PowerHandler powerProvider;
|
||||
protected EnergyStorage energyStorage;
|
||||
|
||||
public Engine(int maxHeat, int maxEnergy, int maxEnergyExtracted) {
|
||||
this.maxHeat = maxHeat;
|
||||
this.maxEnergy = maxEnergy;
|
||||
this.maxEnergyExtracted = maxEnergyExtracted;
|
||||
powerProvider = new PowerHandler(this, PowerHandler.Type.ENGINE);
|
||||
powerProvider.configure(10, 200, 10, 100000);
|
||||
this.maxEnergy = maxEnergy * 10; //TODO Temporary until all are converted
|
||||
this.maxEnergyExtracted = maxEnergyExtracted * 10;
|
||||
energyStorage = new EnergyStorage(maxEnergy, maxEnergyExtracted);
|
||||
//powerProvider = new PowerHandler(this, PowerHandler.Type.ENGINE);
|
||||
//powerProvider.configure(10, 200, 10, 100000);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,47 +92,20 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds energy
|
||||
*
|
||||
* @param addition
|
||||
* @deprecated Use {@link cofh.api.energy.EnergyStorage#modifyEnergyStored(int)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public void addEnergy(float addition) {
|
||||
storedEnergy += addition;
|
||||
|
||||
if (storedEnergy > maxEnergy)
|
||||
storedEnergy = maxEnergy;
|
||||
energyStorage.modifyEnergyStored((int)addition);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param min Minimum energy to extract. Will return 0 if storedEnergy less
|
||||
* than min.
|
||||
* @param max Maximum energy to extract.
|
||||
* @param doExtract Determines whether energy will actually be removed from
|
||||
* the engine.
|
||||
*
|
||||
* @return
|
||||
* @deprecated Use {@link #extractEnergy(net.minecraftforge.common.util.ForgeDirection, int, boolean)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public double extractEnergy(double min, double max, boolean doExtract) {
|
||||
if (storedEnergy < min)
|
||||
return 0;
|
||||
|
||||
double ceiling = max > maxEnergyExtracted ? maxEnergyExtracted : max;
|
||||
|
||||
double extracted;
|
||||
|
||||
if (storedEnergy >= ceiling) {
|
||||
extracted = ceiling;
|
||||
if (doExtract)
|
||||
storedEnergy -= ceiling;
|
||||
} else {
|
||||
extracted = storedEnergy;
|
||||
if (doExtract)
|
||||
storedEnergy = 0;
|
||||
}
|
||||
|
||||
return extracted;
|
||||
}
|
||||
return energyStorage.extractEnergy((int)max, !doExtract);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds heat
|
||||
@@ -185,6 +149,9 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
|
||||
@Override
|
||||
public void updateServerSide() {
|
||||
//doWork appears to be called before updateServerSide, so it's contents have been moved to here.
|
||||
energyStorage.modifyEnergyStored(energyStorage.getMaxReceive());
|
||||
|
||||
TemperatureState energyState = getTemperatureState();
|
||||
if (energyState == TemperatureState.MELTING && heat > 0)
|
||||
forceCooldown = true;
|
||||
@@ -192,9 +159,10 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
forceCooldown = false;
|
||||
|
||||
// Determine targeted tile
|
||||
Position posTarget = new Position(xCoord, yCoord, zCoord, this.getOrientation());
|
||||
/*Position posTarget = new Position(xCoord, yCoord, zCoord, this.getOrientation());
|
||||
posTarget.moveForwards(1.0);
|
||||
TileEntity tile = worldObj.getTileEntity((int) posTarget.x, (int) posTarget.y, (int) posTarget.z);
|
||||
TileEntity tile = worldObj.getTileEntity((int) posTarget.x, (int) posTarget.y, (int) posTarget.z);*/
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + getOrientation().offsetX, yCoord + getOrientation().offsetY, zCoord + getOrientation().offsetZ);
|
||||
|
||||
float newPistonSpeed = getPistonSpeed();
|
||||
if (newPistonSpeed != pistonSpeedServer) {
|
||||
@@ -209,12 +177,12 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
if (progress > 0.5 && stagePiston == 1) {
|
||||
stagePiston = 2;
|
||||
|
||||
if (BlockUtil.isPoweredTile(getOrientation().getOpposite(), tile)) {
|
||||
IPowerReceptor receptor = (IPowerReceptor) tile;
|
||||
double extractedEnergy = extractEnergy(receptor.getPowerReceiver(getOrientation().getOpposite()).getMinEnergyReceived(), receptor.getPowerReceiver(getOrientation().getOpposite()).getMaxEnergyReceived(),
|
||||
true);
|
||||
if (BlockUtil.isRFTile(getOrientation().getOpposite(), tile)) {
|
||||
IEnergyHandler receptor = (IEnergyHandler) tile;
|
||||
int extractedEnergy = extractEnergy(getOrientation(), energyStorage.getMaxExtract(), false); //TODO What should I pass in here?
|
||||
if (extractedEnergy > 0)
|
||||
PluginBuildCraft.instance.invokeReceiveEnergyMethod(PowerHandler.Type.ENGINE, receptor.getPowerReceiver(getOrientation().getOpposite()), extractedEnergy, getOrientation().getOpposite());
|
||||
//PluginBuildCraft.instance.invokeReceiveEnergyMethod(PowerHandler.Type.ENGINE, receptor.getPowerReceiver(getOrientation().getOpposite()), extractedEnergy, getOrientation().getOpposite());
|
||||
receptor.receiveEnergy(getOrientation().getOpposite(), extractedEnergy, false);
|
||||
// receptor.getPowerProvider().receiveEnergy(extractedEnergy);
|
||||
}
|
||||
|
||||
@@ -224,8 +192,8 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
}
|
||||
|
||||
} else if (canPowerTo(tile)) { // If we are not already running, check if
|
||||
IPowerReceptor receptor = (IPowerReceptor) tile;
|
||||
if (extractEnergy(receptor.getPowerReceiver(getOrientation().getOpposite()).getMinEnergyReceived(), receptor.getPowerReceiver(getOrientation().getOpposite()).getMaxEnergyReceived(), false) > 0) {
|
||||
IEnergyHandler receptor = (IEnergyHandler) tile;
|
||||
if (extractEnergy(getOrientation(), energyStorage.getMaxExtract(), true) > 0) {
|
||||
stagePiston = 1; // If we can transfer energy, start running
|
||||
setActive(true);
|
||||
} else
|
||||
@@ -244,7 +212,7 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
}
|
||||
|
||||
private boolean canPowerTo(TileEntity tile) {
|
||||
return isActivated() && BlockUtil.isPoweredTile(getOrientation().getOpposite(), tile);
|
||||
return isActivated() && BlockUtil.isRFTile(getOrientation().getOpposite(), tile);
|
||||
}
|
||||
|
||||
private void setActive(boolean isActive) {
|
||||
@@ -261,12 +229,13 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
for (int i = getOrientation().ordinal() + 1; i <= getOrientation().ordinal() + 6; ++i) {
|
||||
ForgeDirection orient = ForgeDirection.values()[i % 6];
|
||||
|
||||
Position pos = new Position(xCoord, yCoord, zCoord, orient);
|
||||
/*Position pos = new Position(xCoord, yCoord, zCoord, orient);
|
||||
pos.moveForwards(1.0F);
|
||||
|
||||
TileEntity tile = worldObj.getTileEntity((int) pos.x, (int) pos.y, (int) pos.z);
|
||||
TileEntity tile = worldObj.getTileEntity((int) pos.x, (int) pos.y, (int) pos.z);*/
|
||||
TileEntity tile = worldObj.getTileEntity(xCoord + orient.offsetX, yCoord + orient.offsetY, zCoord + orient.offsetZ);
|
||||
|
||||
if (BlockUtil.isPoweredTile(getOrientation().getOpposite(), tile)) {
|
||||
if (BlockUtil.isRFTile(getOrientation().getOpposite(), tile)) {
|
||||
setOrientation(orient);
|
||||
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
@@ -297,8 +266,12 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getEnergyStored(net.minecraftforge.common.util.ForgeDirection)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public float getEnergyStored() {
|
||||
return storedEnergy;
|
||||
return energyStorage.getEnergyStored();
|
||||
}
|
||||
|
||||
public int getHeat() {
|
||||
@@ -356,12 +329,13 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
energyStorage.readFromNBT(nbt);
|
||||
|
||||
heat = nbt.getInteger("EngineHeat");
|
||||
if (nbt.hasKey("EngineStoredEnergy"))
|
||||
/*if (nbt.hasKey("EngineStoredEnergy"))
|
||||
storedEnergy = nbt.getInteger("EngineStoredEnergy");
|
||||
else
|
||||
storedEnergy = nbt.getFloat("EngineStored");
|
||||
storedEnergy = nbt.getFloat("EngineStored");*/
|
||||
|
||||
progress = nbt.getFloat("EngineProgress");
|
||||
forceCooldown = nbt.getBoolean("ForceCooldown");
|
||||
@@ -370,9 +344,10 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
energyStorage.writeToNBT(nbt);
|
||||
|
||||
nbt.setInteger("EngineHeat", heat);
|
||||
nbt.setFloat("EngineStored", storedEnergy);
|
||||
//nbt.setFloat("EngineStored", storedEnergy);
|
||||
nbt.setFloat("EngineProgress", progress);
|
||||
nbt.setBoolean("ForceCooldown", forceCooldown);
|
||||
}
|
||||
@@ -382,38 +357,37 @@ public abstract class Engine extends TileBase implements IPowerHandler, IPipeCon
|
||||
|
||||
public abstract void sendGUINetworkData(Container containerEngine, ICrafting iCrafting);
|
||||
|
||||
/* IPOWERRECEPTOR */
|
||||
@Override
|
||||
public PowerReceiver getPowerReceiver(ForgeDirection side) {
|
||||
return powerProvider.getPowerReceiver();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PowerHandler getPowerHandler() {
|
||||
return powerProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public void doWork(PowerHandler workProvider) {
|
||||
if (!Proxies.common.isSimulating(worldObj))
|
||||
return;
|
||||
|
||||
addEnergy((int) (PluginBuildCraft.instance.invokeUseEnergyMethod(workProvider, 1, maxEnergyReceived(), true) * 0.95F));
|
||||
}
|
||||
|
||||
/* IPIPECONNECTION */
|
||||
@Override
|
||||
public ConnectOverride overridePipeConnection(PipeType type, ForgeDirection with) {
|
||||
if (type == PipeType.POWER)
|
||||
return ConnectOverride.DEFAULT;
|
||||
if (with == getOrientation())
|
||||
return ConnectOverride.DISCONNECT;
|
||||
return ConnectOverride.DEFAULT;
|
||||
}
|
||||
}*/
|
||||
|
||||
/* IPOWEREMITTER */
|
||||
@Override
|
||||
public boolean canEmitPowerFrom(ForgeDirection side) {
|
||||
return side == getOrientation();
|
||||
}
|
||||
@Override
|
||||
public int receiveEnergy(ForgeDirection from, int maxReceive, boolean simulate) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int extractEnergy(ForgeDirection from, int maxExtract, boolean simulate) {
|
||||
return energyStorage.extractEnergy(maxExtract, simulate); //TODO
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEnergyStored(ForgeDirection from) {
|
||||
return energyStorage.getEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxEnergyStored(ForgeDirection from) {
|
||||
return energyStorage.getMaxEnergyStored();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectEnergy(ForgeDirection from) {
|
||||
return from == getOrientation();
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,7 @@ import buildcraft.api.transport.IPipeConnection.ConnectOverride;
|
||||
import buildcraft.api.transport.IPipeTile;
|
||||
import buildcraft.api.transport.IPipeTile.PipeType;
|
||||
|
||||
import cofh.api.energy.IEnergyHandler;
|
||||
import forestry.core.config.Defaults;
|
||||
|
||||
public class BlockUtil {
|
||||
@@ -146,6 +147,10 @@ public class BlockUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated To be removed when MJ is gone. Use {@link #isRFTile} for now.
|
||||
*/
|
||||
@Deprecated
|
||||
public static boolean isPoweredTile(ForgeDirection side, TileEntity tile) {
|
||||
if (tile == null)
|
||||
return false;
|
||||
@@ -157,6 +162,17 @@ public class BlockUtil {
|
||||
return receptor.getPowerReceiver(side) != null;
|
||||
}
|
||||
|
||||
public static boolean isRFTile(ForgeDirection side, TileEntity tile) {
|
||||
if (tile == null)
|
||||
return false;
|
||||
|
||||
if (!(tile instanceof IEnergyHandler))
|
||||
return false;
|
||||
|
||||
IEnergyHandler receptor = (IEnergyHandler) tile;
|
||||
return receptor.canConnectEnergy(side);
|
||||
}
|
||||
|
||||
public static boolean tryPlantPot(World world, int x, int y, int z, Block block) {
|
||||
|
||||
int direction = getDirectionalMetadata(world, x, y, z);
|
||||
|
||||
@@ -167,7 +167,7 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
if (burnTime > 0) {
|
||||
burnTime--;
|
||||
currentOutput = determineFuelValue(FluidRegistry.getFluid(currentFluidId));
|
||||
addEnergy(currentOutput);
|
||||
energyStorage.modifyEnergyStored(currentOutput);
|
||||
} else {
|
||||
burnTime = totalTime = this.determineBurnTime(fuelTank.getFluid().getFluid());
|
||||
currentFluidId = fuelTank.getFluid().getFluid().getID();
|
||||
@@ -353,7 +353,7 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
currentOutput = data;
|
||||
break;
|
||||
case 3:
|
||||
storedEnergy = data;
|
||||
energyStorage.setEnergyStored(data);
|
||||
break;
|
||||
case 4:
|
||||
heat = data;
|
||||
@@ -370,7 +370,7 @@ public class EngineBronze extends Engine implements ISpecialInventory, ILiquidTa
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i, burnTime);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i + 1, totalTime);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i + 2, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i + 3, (int) storedEnergy);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i + 3, energyStorage.getEnergyStored());
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i + 4, heat);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, i + 5, currentFluidId);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ public class EngineClockwork extends Engine {
|
||||
private final static int WIND_DELAY = 10;
|
||||
|
||||
private static final int ENGINE_CLOCKWORK_HEAT_MAX = 300000;
|
||||
private static final float ENGINE_CLOCKWORK_ENERGY_PER_CYCLE = 0.25f;
|
||||
private static final int ENGINE_CLOCKWORK_ENERGY_PER_CYCLE = 2;
|
||||
private static final float ENGINE_CLOCKWORK_WIND_MAX = 8f;
|
||||
|
||||
private static final DamageSourceForestry damageSourceEngineClockwork = new DamageSourceForestry("engine.clockwork");
|
||||
@@ -112,7 +112,7 @@ public class EngineClockwork extends Engine {
|
||||
tension *= 0.9995f;
|
||||
else
|
||||
tension = 0;
|
||||
addEnergy(ENGINE_CLOCKWORK_ENERGY_PER_CYCLE * tension);
|
||||
energyStorage.modifyEnergyStored(ENGINE_CLOCKWORK_ENERGY_PER_CYCLE * (int)tension);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -142,7 +142,7 @@ public class EngineClockwork extends Engine {
|
||||
return 0;
|
||||
|
||||
float fromClockwork = (tension / ENGINE_CLOCKWORK_WIND_MAX) * Defaults.ENGINE_PISTON_SPEED_MAX;
|
||||
return fromClockwork >= 0.01f ? fromClockwork : storedEnergy > 0 ? 0.01f : 0;
|
||||
return fromClockwork >= 0.01f ? fromClockwork : energyStorage.getEnergyStored() > 0 ? 0.01f : 0;
|
||||
}
|
||||
|
||||
@Override public void getGUINetworkData(int i, int j) {}
|
||||
|
||||
@@ -133,7 +133,7 @@ public class EngineCopper extends Engine implements ISpecialInventory, ISidedInv
|
||||
|
||||
if (isActivated()) {
|
||||
currentOutput = determineFuelValue(new ItemStack(fuelItem, 1, fuelItemMeta));
|
||||
addEnergy(currentOutput);
|
||||
energyStorage.modifyEnergyStored(currentOutput);
|
||||
}
|
||||
} else if (isActivated()) {
|
||||
int fuelslot = getFuelSlot();
|
||||
@@ -174,7 +174,7 @@ public class EngineCopper extends Engine implements ISpecialInventory, ISidedInv
|
||||
|
||||
if (isBurning()) {
|
||||
heat++;
|
||||
if (((double) storedEnergy / (double) maxEnergy) > 0.5)
|
||||
if (((double) energyStorage.getEnergyStored() / (double) maxEnergy) > 0.5)
|
||||
heat++;
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ public class EngineCopper extends Engine implements ISpecialInventory, ISidedInv
|
||||
currentOutput = j;
|
||||
break;
|
||||
case 3:
|
||||
storedEnergy = j;
|
||||
energyStorage.setEnergyStored(j);
|
||||
break;
|
||||
case 4:
|
||||
heat = j;
|
||||
@@ -346,7 +346,7 @@ public class EngineCopper extends Engine implements ISpecialInventory, ISidedInv
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 0, burnTime);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 1, totalBurnTime);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 2, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 3, (int)storedEnergy);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 3, energyStorage.getEnergyStored());
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 4, heat);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
|
||||
protected static class EuConfig {
|
||||
public int euForCycle;
|
||||
public int mjPerCycle;
|
||||
public int rfPerCycle;
|
||||
public int euStorage;
|
||||
public int euMaxAccept = 512;
|
||||
|
||||
public EuConfig(int euForCycle, int mjPerCycle, int euStorage) {
|
||||
public EuConfig(int euForCycle, int rfPerCycle, int euStorage) {
|
||||
this.euForCycle = euForCycle;
|
||||
this.mjPerCycle = mjPerCycle;
|
||||
this.rfPerCycle = rfPerCycle;
|
||||
this.euStorage = euStorage;
|
||||
}
|
||||
}
|
||||
@@ -136,7 +136,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
int gain = 0;
|
||||
if (isActivated() && isBurning()) {
|
||||
gain++;
|
||||
if (((double) storedEnergy / (double) maxEnergy) > 0.5)
|
||||
if (((double) energyStorage.getEnergyStored() / (double) maxEnergy) > 0.5)
|
||||
gain++;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,8 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
return;
|
||||
|
||||
if (ic2EnergySink.useEnergy(euConfig.euForCycle)) {
|
||||
currentOutput = euConfig.mjPerCycle;
|
||||
addEnergy(euConfig.mjPerCycle);
|
||||
currentOutput = euConfig.rfPerCycle;
|
||||
energyStorage.modifyEnergyStored(euConfig.rfPerCycle);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
currentOutput = j;
|
||||
break;
|
||||
case 1:
|
||||
storedEnergy = j;
|
||||
energyStorage.setEnergyStored(j);
|
||||
break;
|
||||
case 2:
|
||||
heat = j;
|
||||
@@ -248,7 +248,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
@Override
|
||||
public void sendGUINetworkData(Container containerEngine, ICrafting iCrafting) {
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 0, currentOutput);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 1, (int)storedEnergy);
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 1, energyStorage.getEnergyStored());
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 2, heat);
|
||||
if (ic2EnergySink != null) {
|
||||
iCrafting.sendProgressBarUpdate(containerEngine, 3, (short) ic2EnergySink.getEnergyStored());
|
||||
@@ -258,7 +258,7 @@ public class EngineTin extends Engine implements ISocketable, IInventory {
|
||||
// / ENERGY CONFIG CHANGE
|
||||
public void changeEnergyConfig(int euChange, int mjChange, int storageChange) {
|
||||
euConfig.euForCycle += euChange;
|
||||
euConfig.mjPerCycle += mjChange;
|
||||
euConfig.rfPerCycle += mjChange;
|
||||
euConfig.euStorage += storageChange;
|
||||
|
||||
if (ic2EnergySink != null) ic2EnergySink.setCapacity(euConfig.euStorage);
|
||||
|
||||
Reference in new issue
Block a user