Revert switch change

This commit is contained in:
Muramasa 2016-08-14 08:12:25 +01:00
parent 7874d1c91f
commit 5e5fa8cf38
2 changed files with 101 additions and 114 deletions

View file

@ -180,9 +180,9 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
long tTime = System.currentTimeMillis();
int tCode = 0;
try {
for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
if (tCode == 0) {
try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
switch (tCode) {
case 0:
tCode++;
if (mTickTimer++ == 0) {
oX = xCoord;
@ -196,8 +196,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mMetaTileEntity.onFirstTick(this);
if (!hasValidMetaTileEntity()) return;
}
}
if (tCode == 1) {
case 1:
tCode++;
if (isClientSide()) {
if (mColor != oColor) {
@ -211,8 +210,12 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mNeedsUpdate = false;
}
}
}
if (tCode >= 2 && tCode <= 7) {
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
if (isServerSide() && mTickTimer > 10) {
for (byte i = (byte) (tCode - 2); i < 6; i++)
if (getCoverIDAtSide(i) != 0) {
@ -229,12 +232,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mConnections = (byte) ((mConnections & ~64) | -128);
}
}
}
if (tCode == 8) {
case 8:
tCode = 9;
mMetaTileEntity.onPreTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) return;}
if (tCode == 9) {
if (!hasValidMetaTileEntity()) return;
case 9:
tCode++;
if (isServerSide()) {
if (mTickTimer == 10) {
@ -251,12 +253,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
clearTileEntityBuffer();
}
}
}
if (tCode == 10) {
case 10:
tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) return;}
if (tCode == 11) {
if (!hasValidMetaTileEntity()) return;
case 11:
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
@ -280,15 +281,13 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mNeedsBlockUpdate = false;
}
}
}
if (tCode > 11) {
default:
tCode = -1;
break;
}
}
} catch (Throwable e) {
gregtech.api.util.GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
e.printStackTrace(gregtech.api.util.GT_Log.err);
}
if (isServerSide() && hasValidMetaTileEntity()) {

View file

@ -250,9 +250,9 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
long tTime = System.currentTimeMillis();
int tCode = 0;
try {
for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
if (tCode == 0) {
try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
switch (tCode) {
case 0:
tCode++;
if (mTickTimer++ == 0) {
oX = xCoord;
@ -262,17 +262,14 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
if (getCoverIDAtSide(i) != 0)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
dropCover(i, i, true);
worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
mMetaTileEntity.onFirstTick(this);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
}
if (tCode == 1) {
case 1:
tCode++;
if (isClientSide()) {
if (mColor != oColor) {
@ -299,8 +296,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mNeedsUpdate = false;
}
}
}
if (tCode >= 2 && tCode <= 7) {
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
if (isServerSide() && mTickTimer > 10) {
for (byte i = (byte) (tCode - 2); i < 6; i++)
if (getCoverIDAtSide(i) != 0) {
@ -317,8 +318,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
}
}
if (tCode == 8) {
case 8:
tCode = 9;
if (isServerSide()) {
if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
@ -327,16 +327,14 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mAverageEUInput[mAverageEUInputIndex] = 0;
mAverageEUOutput[mAverageEUOutputIndex] = 0;
}
}
if (tCode == 9) {
case 9:
tCode++;
mMetaTileEntity.onPreTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
if (tCode == 10) {
case 10:
tCode++;
if (isServerSide()) {
if (mRedstone != oRedstone || mTickTimer == 10) {
@ -420,10 +418,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
return;
}
if (GregTech_API.sMachineThunderExplosions && worldObj.isThundering() && getBiome().rainfall > 0 && getRandomNumber(3) == 0) {
try {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
} catch (Exception e) {
}
doEnergyExplosion();
}
}
@ -436,7 +431,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
return;
}
}
if (tCode == 11) {
case 11:
tCode++;
if (isServerSide()) {
if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
@ -450,8 +445,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
}
}
}
if (tCode == 12) {
case 12:
tCode++;
if (isServerSide()) {
if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
@ -465,24 +459,21 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
}
}
}
if (tCode == 13) {
case 13:
tCode++;
updateStatus();
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
if (tCode == 14) {
case 14:
tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
if (tCode == 15) {
case 15:
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
@ -519,16 +510,13 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mNeedsBlockUpdate = false;
}
}
}
if (tCode > 15) {
default:
tCode = -1;
break;
}
}
}
} catch (Throwable e) {
gregtech.api.util.GT_Log.err.println("Encountered Exception while ticking MetaTileEntity in Step " + (tCode - 1) + ". The Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
e.printStackTrace(gregtech.api.util.GT_Log.err);
}
if (isServerSide() && hasValidMetaTileEntity()) {