Revert experimental pipe flow changes
This commit is contained in:
parent
738d5ede52
commit
99bae591d5
4 changed files with 20 additions and 25 deletions
|
@ -36,7 +36,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
|
|||
private short currentTime = 0;
|
||||
|
||||
// Tracks how much of the liquid is inbound in timeslots
|
||||
private int[] incomming = new int[travelDelay];
|
||||
private short[] incomming = new short[travelDelay];
|
||||
|
||||
// Tracks how much is currently available (has spent it's inbound delaytime)
|
||||
|
||||
|
@ -88,24 +88,24 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
|
|||
|
||||
public void reset() {
|
||||
this.setLiquid(null);
|
||||
incomming = new int[travelDelay];
|
||||
incomming = new short[travelDelay];
|
||||
}
|
||||
|
||||
public int getAvailable() {
|
||||
int all = this.getLiquid() != null ? this.getLiquid().amount : 0;
|
||||
for (int slot : incomming) {
|
||||
for (short slot : incomming) {
|
||||
all -= slot;
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
public LiquidTank readFromNBT(NBTTagCompound compoundTag) {
|
||||
super.readFromNBT(compoundTag);
|
||||
this.setCapacity(compoundTag.getInteger("capacity"));
|
||||
|
||||
for (int i = 0; i < travelDelay; ++i) {
|
||||
incomming[i] = compoundTag.getShort("in[" + i + "]");
|
||||
}
|
||||
setLiquid(LiquidStack.loadLiquidStackFromNBT(compoundTag));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,9 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
|
|||
incomming[i] = subTag.getShort("in[" + i + "]");
|
||||
}
|
||||
|
||||
super.writeToNBT(subTag);
|
||||
if (this.getLiquid() != null) {
|
||||
this.getLiquid().writeToNBT(subTag);
|
||||
}
|
||||
return subTag;
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +140,7 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
|
|||
|
||||
public byte initClient = 0;
|
||||
public short travelDelay = 12;
|
||||
public int flowRate = 10;
|
||||
public short flowRate = 10;
|
||||
public LiquidStack[] renderCache = new LiquidStack[orientations.length];
|
||||
|
||||
private final PipeSection[] internalTanks = new PipeSection[orientations.length];
|
||||
|
@ -550,8 +552,4 @@ public class PipeTransportLiquids extends PipeTransport implements ITankContaine
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void forceSize(ForgeDirection dir, int maxCapacity) {
|
||||
internalTanks[dir.ordinal()].setCapacity(maxCapacity);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ public class PipeLiquidsEmerald extends PipeLiquidsWood {
|
|||
standardIconIndex = PipeIconProvider.PipeLiquidsEmerald_Standard;
|
||||
solidIconIndex = PipeIconProvider.PipeAllEmerald_Solid;
|
||||
|
||||
((PipeTransportLiquids) transport).flowRate = Short.MAX_VALUE - 1;
|
||||
((PipeTransportLiquids) transport).flowRate = 40;
|
||||
((PipeTransportLiquids) transport).travelDelay = 4;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,15 +45,13 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
|
|||
public PipeLiquidsWood(int itemID) {
|
||||
this(new PipeLogicWood(), itemID);
|
||||
}
|
||||
|
||||
|
||||
protected PipeLiquidsWood(PipeLogic logic, int itemID) {
|
||||
super(new PipeTransportLiquids(), logic, itemID);
|
||||
|
||||
powerProvider = PowerFramework.currentFramework.createPowerProvider();
|
||||
powerProvider.configure(50, 1, 64, 1, 250);
|
||||
powerProvider.configurePowerPerdition(64, 1);
|
||||
((PipeTransportLiquids) transport).flowRate = 1000;
|
||||
((PipeTransportLiquids) transport).travelDelay = 2;
|
||||
powerProvider.configure(50, 1, 100, 1, 250);
|
||||
powerProvider.configurePowerPerdition(1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -61,7 +59,7 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
|
|||
*/
|
||||
@Override
|
||||
public void doWork() {
|
||||
if (powerProvider.getEnergyStored() <= 0 || liquidToExtract > LiquidContainerRegistry.BUCKET_VOLUME * 4.0f)
|
||||
if (powerProvider.getEnergyStored() <= 0)
|
||||
return;
|
||||
|
||||
World w = worldObj;
|
||||
|
@ -79,10 +77,9 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
|
|||
if (!PipeManager.canExtractLiquids(this, w, (int) pos.x, (int) pos.y, (int) pos.z))
|
||||
return;
|
||||
|
||||
double p = powerProvider.useEnergy(1, 64, true);
|
||||
double d = ( Math.log(p)/Math.log(2) + 1 ) * LiquidContainerRegistry.BUCKET_VOLUME / 7.0f;
|
||||
System.out.printf("Extracting %f %f %f\n",p,d,( Math.log(p)/Math.log(2) + 1 ));
|
||||
liquidToExtract = (int)Math.floor(d);
|
||||
if (liquidToExtract <= LiquidContainerRegistry.BUCKET_VOLUME) {
|
||||
liquidToExtract += powerProvider.useEnergy(1, 1, true) * LiquidContainerRegistry.BUCKET_VOLUME;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -111,15 +108,15 @@ public class PipeLiquidsWood extends Pipe implements IPowerReceptor {
|
|||
if (tile instanceof ITankContainer) {
|
||||
ITankContainer container = (ITankContainer) tile;
|
||||
|
||||
LiquidStack extracted = container.drain(pos.orientation.getOpposite(), liquidToExtract, false);
|
||||
int flowRate = ((PipeTransportLiquids) transport).flowRate;
|
||||
|
||||
LiquidStack extracted = container.drain(pos.orientation.getOpposite(), liquidToExtract > flowRate ? flowRate : liquidToExtract, false);
|
||||
|
||||
int inserted = 0;
|
||||
if (extracted != null) {
|
||||
System.out.printf("Can extract %d of %d\n", extracted.amount, extracted.itemID);
|
||||
inserted = ((PipeTransportLiquids) transport).fill(pos.orientation, extracted, true);
|
||||
|
||||
container.drain(pos.orientation.getOpposite(), inserted, true);
|
||||
System.out.printf("Did extract %d of %d\n", inserted, extracted.itemID);
|
||||
}
|
||||
|
||||
liquidToExtract -= inserted;
|
||||
|
|
|
@ -43,7 +43,7 @@ public class PipeLogicWood extends PipeLogic {
|
|||
}
|
||||
|
||||
if (newMeta != meta) {
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta,3);
|
||||
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, newMeta,0);
|
||||
container.scheduleRenderUpdate();
|
||||
// worldObj.markBlockNeedsUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue