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(); long tTime = System.currentTimeMillis();
int tCode = 0; int tCode = 0;
try { try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { switch (tCode) {
if (tCode == 0) { case 0:
tCode++; tCode++;
if (mTickTimer++ == 0) { if (mTickTimer++ == 0) {
oX = xCoord; oX = xCoord;
@ -196,8 +196,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mMetaTileEntity.onFirstTick(this); mMetaTileEntity.onFirstTick(this);
if (!hasValidMetaTileEntity()) return; if (!hasValidMetaTileEntity()) return;
} }
} case 1:
if (tCode == 1) {
tCode++; tCode++;
if (isClientSide()) { if (isClientSide()) {
if (mColor != oColor) { if (mColor != oColor) {
@ -211,8 +210,12 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mNeedsUpdate = false; mNeedsUpdate = false;
} }
} }
} case 2:
if (tCode >= 2 && tCode <= 7) { case 3:
case 4:
case 5:
case 6:
case 7:
if (isServerSide() && mTickTimer > 10) { if (isServerSide() && mTickTimer > 10) {
for (byte i = (byte) (tCode - 2); i < 6; i++) for (byte i = (byte) (tCode - 2); i < 6; i++)
if (getCoverIDAtSide(i) != 0) { if (getCoverIDAtSide(i) != 0) {
@ -229,12 +232,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mConnections = (byte) ((mConnections & ~64) | -128); mConnections = (byte) ((mConnections & ~64) | -128);
} }
} }
} case 8:
if (tCode == 8) {
tCode = 9; tCode = 9;
mMetaTileEntity.onPreTick(this, mTickTimer); mMetaTileEntity.onPreTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) return;} if (!hasValidMetaTileEntity()) return;
if (tCode == 9) { case 9:
tCode++; tCode++;
if (isServerSide()) { if (isServerSide()) {
if (mTickTimer == 10) { if (mTickTimer == 10) {
@ -251,12 +253,11 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
clearTileEntityBuffer(); clearTileEntityBuffer();
} }
} }
} case 10:
if (tCode == 10) {
tCode++; tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer); mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) return;} if (!hasValidMetaTileEntity()) return;
if (tCode == 11) { case 11:
tCode++; tCode++;
if (isServerSide()) { if (isServerSide()) {
if (mTickTimer % 10 == 0) { if (mTickTimer % 10 == 0) {
@ -280,15 +281,13 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
mNeedsBlockUpdate = false; mNeedsBlockUpdate = false;
} }
} }
} default:
if (tCode > 11) {
tCode = -1; tCode = -1;
break;
} }
} }
} catch (Throwable e) { } 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!!!"); 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()) { if (isServerSide() && hasValidMetaTileEntity()) {

View file

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