update changelog, try to fix #2880

This commit is contained in:
Adrian 2015-07-11 09:20:51 +02:00
parent f18757da0f
commit 3ba539ade3
2 changed files with 68 additions and 42 deletions

View file

@ -1,10 +1,14 @@
Bugs fixed:
* [#2880] Try to fix fluid pipe bug (asie)
* [#2878] Robot NPE for robots prior to 7.0.13 fix (asie)
* [#2877] Survival blueprint crash (asie)
* [#2841] Another crash with Oil in the Nether (asie)
* [#2837] Massive lag with Construction Markers (hea3ven)
* [#2831] Robots sinking through the ground (hea3ven)
* Allow Builders to use arbitrary IPathProviders (asie)
* Block breaking robots sleeping in mid air (hea3ven)
* Error in robot AI loading (hea3ven)
* Incorrect Request Needed Items action name (asie)
* Packages crashing Minecraft if mods are removed (asie)
* Robots ignoring gate config on their linked station when equipping items (hea3ven)

View file

@ -226,9 +226,7 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
return;
}
if (fluidType != null) {
moveFluids();
}
moveFluids();
if (networkSyncTracker.markTimeIfDelay(container.getWorldObj())) {
boolean init = false;
@ -245,17 +243,22 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
}
private void moveFluids() {
short newTimeSlot = (short) (container.getWorldObj().getTotalWorldTime() % travelDelay);
short outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0);
if (fluidType != null) {
short newTimeSlot = (short) (container.getWorldObj().getTotalWorldTime() % travelDelay);
int outputCount = computeCurrentConnectionStatesAndTickFlows(newTimeSlot > 0 && newTimeSlot < travelDelay ? newTimeSlot : 0);
moveFromPipe(outputCount);
moveFromCenter();
moveToCenter();
if (fluidType != null) {
moveFromPipe(outputCount);
moveFromCenter();
moveToCenter();
}
} else {
computeTTLs();
}
}
private void moveFromPipe(short outputCount) {
private void moveFromPipe(int outputCount) {
// Move liquid from the non-center to the connected output blocks
boolean pushed = false;
if (outputCount > 0) {
for (ForgeDirection o : directions) {
if (transferState[o.ordinal()] == TransferState.Output) {
@ -270,7 +273,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
if (liquidToPush.amount > 0) {
int filled = ((IFluidHandler) target).fill(o.getOpposite(), liquidToPush, true);
section.drain(filled, true);
pushed = true;
if (filled <= 0) {
outputTTL[o.ordinal()]--;
}
@ -278,19 +280,6 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
}
}
}
if (pushed) {
boolean hasFluid = false;
for (PipeSection s: sections) {
if (s.amount > 0) {
hasFluid = true;
break;
}
}
if (!hasFluid) {
setFluidType(null);
}
}
}
private void moveFromCenter() {
@ -361,43 +350,76 @@ public class PipeTransportFluids extends PipeTransport implements IFluidHandler
}
}
private short computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) {
short outputCount = 0;
private void computeTTLs() {
for (int i = 0; i < 6; i++) {
if (transferState[i] == TransferState.Input) {
if (inputTTL[i] > 0) {
inputTTL[i]--;
} else {
transferState[i] = TransferState.None;
}
}
// Processes all interna4al tanks
if (outputCooldown[i] > 0) {
outputCooldown[i]--;
} else {
if (outputTTL[i] > 0) {
outputTTL[i]--;
} else {
transferState[i] = TransferState.None;
}
}
}
}
private int computeCurrentConnectionStatesAndTickFlows(short newTimeSlot) {
int outputCount = 0;
int fluidAmount = 0;
// Processes all internal tanks
for (ForgeDirection direction : orientations) {
sections[direction.ordinal()].setTime(newTimeSlot);
sections[direction.ordinal()].moveFluids();
int dirI = direction.ordinal();
PipeSection section = sections[dirI];
fluidAmount += section.amount;
section.setTime(newTimeSlot);
section.moveFluids();
// Input processing
if (direction == ForgeDirection.UNKNOWN) {
continue;
}
if (transferState[direction.ordinal()] == TransferState.Input) {
inputTTL[direction.ordinal()]--;
if (inputTTL[direction.ordinal()] <= 0) {
transferState[direction.ordinal()] = TransferState.None;
if (transferState[dirI] == TransferState.Input) {
inputTTL[dirI]--;
if (inputTTL[dirI] <= 0) {
transferState[dirI] = TransferState.None;
}
continue;
}
if (!container.pipe.outputOpen(direction)) {
transferState[direction.ordinal()] = TransferState.None;
transferState[dirI] = TransferState.None;
continue;
}
if (outputCooldown[direction.ordinal()] > 0) {
outputCooldown[direction.ordinal()]--;
if (outputCooldown[dirI] > 0) {
outputCooldown[dirI]--;
continue;
}
if (outputTTL[direction.ordinal()] <= 0) {
transferState[direction.ordinal()] = TransferState.None;
outputCooldown[direction.ordinal()] = OUTPUT_COOLDOWN;
outputTTL[direction.ordinal()] = OUTPUT_TTL;
if (outputTTL[dirI] <= 0) {
transferState[dirI] = TransferState.None;
outputCooldown[dirI] = OUTPUT_COOLDOWN;
outputTTL[dirI] = OUTPUT_TTL;
continue;
}
if (canReceiveCache[direction.ordinal()] && outputOpen(direction)) {
transferState[direction.ordinal()] = TransferState.Output;
if (canReceiveCache[dirI] && outputOpen(direction)) {
transferState[dirI] = TransferState.Output;
outputCount++;
}
}
if (fluidAmount == 0) {
setFluidType(null);
}
return outputCount;
}