Engines use float for energy now.

This commit is contained in:
SirSengir 2012-07-21 10:55:40 +02:00
parent 81b58867a5
commit 5bd849d60f
5 changed files with 20 additions and 20 deletions

View file

@ -33,13 +33,13 @@ public class IronEngineFuel {
}
public final LiquidStack liquid;
public final int powerPerCycle;
public final float powerPerCycle;
public final int totalBurningTime;
public IronEngineFuel(int liquidId, int powerPerCycle, int totalBurningTime) {
public IronEngineFuel(int liquidId, float powerPerCycle, int totalBurningTime) {
this(new LiquidStack(liquidId, BuildCraftAPI.BUCKET_VOLUME, 0), powerPerCycle, totalBurningTime);
}
public IronEngineFuel(LiquidStack liquid, int powerPerCycle, int totalBurningTime) {
public IronEngineFuel(LiquidStack liquid, float powerPerCycle, int totalBurningTime) {
this.liquid = liquid;
this.powerPerCycle = powerPerCycle;
this.totalBurningTime = totalBurningTime;

View file

@ -21,12 +21,12 @@ public abstract class Engine {
public int maxEnergy;
protected int currentOutput = 0;
protected float currentOutput = 0;
public @TileNetworkData
float progress;
public @TileNetworkData
Orientations orientation;
public int energy;
public float energy;
public @TileNetworkData
EnergyStage energyStage = EnergyStage.Blue;
@ -84,7 +84,7 @@ public abstract class Engine {
public abstract void delete();
public void addEnergy(int addition) {
public void addEnergy(float addition) {
energy += addition;
if (getEnergyStage() == EnergyStage.Explosion) {
@ -96,7 +96,7 @@ public abstract class Engine {
}
}
public int extractEnergy(int min, int max, boolean doExtract) {
public float extractEnergy(int min, int max, boolean doExtract) {
if (energy < min) {
return 0;
}
@ -109,7 +109,7 @@ public abstract class Engine {
actualMax = max;
}
int extracted;
float extracted;
if (energy >= actualMax) {
extracted = actualMax;
@ -154,11 +154,11 @@ public abstract class Engine {
return 0;
}
public int getEnergyStored() {
public float getEnergyStored() {
return energy;
}
public int getCurrentOutput() {
public float getCurrentOutput() {
return currentOutput;
}

View file

@ -227,10 +227,10 @@ public class EngineIron extends Engine {
public void getGUINetworkData(int i, int j) {
switch (i) {
case 0:
energy = j;
energy = j / 10;
break;
case 1:
currentOutput = j;
currentOutput = j / 10;
break;
case 2:
heat = j;
@ -252,8 +252,8 @@ public class EngineIron extends Engine {
@Override
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, energy);
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, currentOutput);
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, Math.round(energy * 10));
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, Math.round(currentOutput * 10));
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, heat);
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, liquidQty);
iCrafting.updateCraftingInventoryInfo(containerEngine, 4, liquidId);

View file

@ -155,15 +155,15 @@ public class EngineStone extends Engine {
@Override
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, energy);
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, currentOutput);
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, Math.round(energy));
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, Math.round(currentOutput));
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, burnTime);
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, totalBurnTime);
}
@Override
public int getHeat() {
return energy;
return Math.round(energy);
}
/* IINVENTORY */

View file

@ -121,7 +121,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
if (isPoweredTile(tile)) {
IPowerReceptor receptor = (IPowerReceptor) tile;
int extracted = engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(),
float extracted = engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(),
receptor.getPowerProvider().getMaxEnergyReceived(), true);
if (extracted > 0) {
@ -227,7 +227,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
if (engine != null) {
engine.progress = nbttagcompound.getFloat("progress");
engine.energy = nbttagcompound.getInteger("energy");
engine.energy = nbttagcompound.getFloat("energyF");
engine.orientation = Orientations.values()[orientation];
}
@ -245,7 +245,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
if (engine != null) {
nbttagcompound.setInteger("orientation", orientation);
nbttagcompound.setFloat("progress", engine.progress);
nbttagcompound.setInteger("energy", engine.energy);
nbttagcompound.setFloat("energyF", engine.energy);
}
if (engine != null) {