Merge branch 'master' into LiquidPipeRewrite
This commit is contained in:
commit
c6c6a0c9cb
9 changed files with 63 additions and 21 deletions
|
@ -132,7 +132,7 @@ public class BuildCraftEnergy {
|
||||||
RefineryRecipe.registerRefineryRecipe(new RefineryRecipe(new LiquidStack(oilStill.blockID, 1, 0), null, new LiquidStack(fuel.shiftedIndex, 1, 0), 10, 1));
|
RefineryRecipe.registerRefineryRecipe(new RefineryRecipe(new LiquidStack(oilStill.blockID, 1, 0), null, new LiquidStack(fuel.shiftedIndex, 1, 0), 10, 1));
|
||||||
|
|
||||||
// Iron Engine Fuels
|
// Iron Engine Fuels
|
||||||
IronEngineFuel.fuels.add(new IronEngineFuel(oilStill.blockID, 1, 20000));
|
IronEngineFuel.fuels.add(new IronEngineFuel(Block.lavaStill.blockID, 1, 20000));
|
||||||
IronEngineFuel.fuels.add(new IronEngineFuel(oilStill.blockID, 2, 10000));
|
IronEngineFuel.fuels.add(new IronEngineFuel(oilStill.blockID, 2, 10000));
|
||||||
IronEngineFuel.fuels.add(new IronEngineFuel(fuel.shiftedIndex, 5, 50000));
|
IronEngineFuel.fuels.add(new IronEngineFuel(fuel.shiftedIndex, 5, 50000));
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,13 @@ public class IronEngineFuel {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final LiquidStack liquid;
|
public final LiquidStack liquid;
|
||||||
public final int powerPerCycle;
|
public final float powerPerCycle;
|
||||||
public final int totalBurningTime;
|
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);
|
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.liquid = liquid;
|
||||||
this.powerPerCycle = powerPerCycle;
|
this.powerPerCycle = powerPerCycle;
|
||||||
this.totalBurningTime = totalBurningTime;
|
this.totalBurningTime = totalBurningTime;
|
||||||
|
|
|
@ -9,6 +9,7 @@ public interface ILiquidTank {
|
||||||
*/
|
*/
|
||||||
LiquidStack getLiquid();
|
LiquidStack getLiquid();
|
||||||
void setLiquid(LiquidStack liquid);
|
void setLiquid(LiquidStack liquid);
|
||||||
|
void setCapacity(int capacity);
|
||||||
int getCapacity();
|
int getCapacity();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,10 +25,16 @@ public class LiquidTank implements ILiquidTank {
|
||||||
this.liquid = liquid;
|
this.liquid = liquid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCapacity(int capacity) {
|
||||||
|
this.capacity = capacity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCapacity() {
|
public int getCapacity() {
|
||||||
return this.capacity;
|
return this.capacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int fill(LiquidStack resource, boolean doFill) {
|
public int fill(LiquidStack resource, boolean doFill) {
|
||||||
if(resource == null || resource.itemID <= 0)
|
if(resource == null || resource.itemID <= 0)
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package net.minecraft.src.buildcraft.api.tools;
|
||||||
|
|
||||||
|
import net.minecraft.src.ItemStack;
|
||||||
|
import net.minecraft.src.buildcraft.api.liquids.ILiquidTank;
|
||||||
|
import net.minecraft.src.buildcraft.api.liquids.LiquidStack;
|
||||||
|
|
||||||
|
public interface IToolPipette {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param pipette ItemStack of the pipette.
|
||||||
|
* @return Capacity of the pipette.
|
||||||
|
*/
|
||||||
|
int getCapacity(ItemStack pipette);
|
||||||
|
/**
|
||||||
|
* @param pipette
|
||||||
|
* @return true if the pipette can pipette.
|
||||||
|
*/
|
||||||
|
boolean canPipette(ItemStack pipette);
|
||||||
|
/**
|
||||||
|
* Fills the pipette with the given liquid stack.
|
||||||
|
* @param pipette
|
||||||
|
* @param liquid
|
||||||
|
* @param doFill
|
||||||
|
* @return Amount of liquid used in filling the pipette.
|
||||||
|
*/
|
||||||
|
int fill(ItemStack pipette, LiquidStack liquid, boolean doFill);
|
||||||
|
/**
|
||||||
|
* Drains liquid from the pipette
|
||||||
|
* @param pipette
|
||||||
|
* @param maxDrain
|
||||||
|
* @param doDrain
|
||||||
|
* @return Liquid stack representing the liquid and amount drained from the pipette.
|
||||||
|
*/
|
||||||
|
LiquidStack drain(ItemStack pipette, int maxDrain, boolean doDrain);
|
||||||
|
}
|
|
@ -21,12 +21,12 @@ public abstract class Engine {
|
||||||
|
|
||||||
public int maxEnergy;
|
public int maxEnergy;
|
||||||
|
|
||||||
protected int currentOutput = 0;
|
protected float currentOutput = 0;
|
||||||
public @TileNetworkData
|
public @TileNetworkData
|
||||||
float progress;
|
float progress;
|
||||||
public @TileNetworkData
|
public @TileNetworkData
|
||||||
Orientations orientation;
|
Orientations orientation;
|
||||||
public int energy;
|
public float energy;
|
||||||
public @TileNetworkData
|
public @TileNetworkData
|
||||||
EnergyStage energyStage = EnergyStage.Blue;
|
EnergyStage energyStage = EnergyStage.Blue;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public abstract class Engine {
|
||||||
|
|
||||||
public abstract void delete();
|
public abstract void delete();
|
||||||
|
|
||||||
public void addEnergy(int addition) {
|
public void addEnergy(float addition) {
|
||||||
energy += addition;
|
energy += addition;
|
||||||
|
|
||||||
if (getEnergyStage() == EnergyStage.Explosion) {
|
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) {
|
if (energy < min) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public abstract class Engine {
|
||||||
actualMax = max;
|
actualMax = max;
|
||||||
}
|
}
|
||||||
|
|
||||||
int extracted;
|
float extracted;
|
||||||
|
|
||||||
if (energy >= actualMax) {
|
if (energy >= actualMax) {
|
||||||
extracted = actualMax;
|
extracted = actualMax;
|
||||||
|
@ -154,11 +154,11 @@ public abstract class Engine {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getEnergyStored() {
|
public float getEnergyStored() {
|
||||||
return energy;
|
return energy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCurrentOutput() {
|
public float getCurrentOutput() {
|
||||||
return currentOutput;
|
return currentOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -227,10 +227,10 @@ public class EngineIron extends Engine {
|
||||||
public void getGUINetworkData(int i, int j) {
|
public void getGUINetworkData(int i, int j) {
|
||||||
switch (i) {
|
switch (i) {
|
||||||
case 0:
|
case 0:
|
||||||
energy = j;
|
energy = j / 10;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
currentOutput = j;
|
currentOutput = j / 10;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
heat = j;
|
heat = j;
|
||||||
|
@ -252,8 +252,8 @@ public class EngineIron extends Engine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
|
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, energy);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, Math.round(energy * 10));
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, currentOutput);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, Math.round(currentOutput * 10));
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, heat);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, heat);
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, liquidQty);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, liquidQty);
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 4, liquidId);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 4, liquidId);
|
||||||
|
|
|
@ -155,15 +155,15 @@ public class EngineStone extends Engine {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
|
public void sendGUINetworkData(ContainerEngine containerEngine, ICrafting iCrafting) {
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, energy);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 0, Math.round(energy));
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, currentOutput);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 1, Math.round(currentOutput));
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, burnTime);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 2, burnTime);
|
||||||
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, totalBurnTime);
|
iCrafting.updateCraftingInventoryInfo(containerEngine, 3, totalBurnTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getHeat() {
|
public int getHeat() {
|
||||||
return energy;
|
return Math.round(energy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* IINVENTORY */
|
/* IINVENTORY */
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
||||||
if (isPoweredTile(tile)) {
|
if (isPoweredTile(tile)) {
|
||||||
IPowerReceptor receptor = (IPowerReceptor) tile;
|
IPowerReceptor receptor = (IPowerReceptor) tile;
|
||||||
|
|
||||||
int extracted = engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(),
|
float extracted = engine.extractEnergy(receptor.getPowerProvider().getMinEnergyReceived(),
|
||||||
receptor.getPowerProvider().getMaxEnergyReceived(), true);
|
receptor.getPowerProvider().getMaxEnergyReceived(), true);
|
||||||
|
|
||||||
if (extracted > 0) {
|
if (extracted > 0) {
|
||||||
|
@ -227,7 +227,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
||||||
|
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
engine.progress = nbttagcompound.getFloat("progress");
|
engine.progress = nbttagcompound.getFloat("progress");
|
||||||
engine.energy = nbttagcompound.getInteger("energy");
|
engine.energy = nbttagcompound.getFloat("energyF");
|
||||||
engine.orientation = Orientations.values()[orientation];
|
engine.orientation = Orientations.values()[orientation];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,7 +245,7 @@ public class TileEngine extends TileBuildCraft implements IPowerReceptor, IInven
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
nbttagcompound.setInteger("orientation", orientation);
|
nbttagcompound.setInteger("orientation", orientation);
|
||||||
nbttagcompound.setFloat("progress", engine.progress);
|
nbttagcompound.setFloat("progress", engine.progress);
|
||||||
nbttagcompound.setInteger("energy", engine.energy);
|
nbttagcompound.setFloat("energyF", engine.energy);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
|
|
Loading…
Reference in a new issue