Bugfixes 5

This commit is contained in:
Muramasa 2016-08-14 05:36:12 +01:00
parent b6032a3bd2
commit bfccecf87b
22 changed files with 425 additions and 409 deletions

View file

@ -600,7 +600,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
@Override @Override
public boolean isItemStackUsable(ItemStack aStack) { public boolean isItemStackUsable(ItemStack aStack) {
IToolStats tStats = getToolStatsInternal(aStack); IToolStats tStats = getToolStatsInternal(aStack);
if (aStack.getItemDamage() % 2 == 1 || tStats == null) { if (aStack.getItemDamage() % 2 != 0 || tStats == null) {
NBTTagCompound aNBT = aStack.getTagCompound(); NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) aNBT.removeTag("ench"); if (aNBT != null) aNBT.removeTag("ench");
return false; return false;

View file

@ -182,116 +182,123 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
long tTime = System.currentTimeMillis(); long tTime = System.currentTimeMillis();
int tCode = 0; int tCode = 0;
for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
try { //replace switch in if
switch (tCode) { //switch (tCode) {
case 0: //case 0:
tCode++; if (tCode == 0) {
if (mTickTimer++ == 0) { tCode++;
oX = xCoord; if (mTickTimer++ == 0) {
oY = yCoord; oX = xCoord;
oZ = zCoord; oY = yCoord;
if (isServerSide()) for (byte i = 0; i < 6; i++) oZ = zCoord;
if (getCoverIDAtSide(i) != 0) if (isServerSide()) for (byte i = 0; i < 6; i++)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) if (getCoverIDAtSide(i) != 0)
dropCover(i, i, true); if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); dropCover(i, i, true);
mMetaTileEntity.onFirstTick(this); worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
if (!hasValidMetaTileEntity()) return; mMetaTileEntity.onFirstTick(this);
} if (!hasValidMetaTileEntity()) return;
case 1: }}
tCode++; //case 1:
if (isClientSide()) { if (tCode == 1) {
if (mColor != oColor) { tCode++;
mMetaTileEntity.onColorChangeClient(oColor = mColor); if (isClientSide()) {
issueTextureUpdate(); if (mColor != oColor) {
} mMetaTileEntity.onColorChangeClient(oColor = mColor);
issueTextureUpdate();
}
if (mNeedsUpdate) { if (mNeedsUpdate) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
//worldObj.func_147479_m(xCoord, yCoord, zCoord); //worldObj.func_147479_m(xCoord, yCoord, zCoord);
mNeedsUpdate = false; mNeedsUpdate = false;
} }
} }}
case 2: /*case 2:
case 3: case 3:
case 4: case 4:
case 5: case 5:
case 6: case 6:
case 7: case 7:*/
if (isServerSide() && mTickTimer > 10) { if (tCode >= 2 && tCode <= 7) {
for (byte i = (byte) (tCode - 2); i < 6; i++) if (isServerSide() && mTickTimer > 10) {
if (getCoverIDAtSide(i) != 0) { for (byte i = (byte) (tCode - 2); i < 6; i++)
tCode++; if (getCoverIDAtSide(i) != 0) {
GT_CoverBehavior tCover = getCoverBehaviorAtSide(i); tCode++;
int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this); GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) { int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer); if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
if (!hasValidMetaTileEntity()) return; mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
} if (!hasValidMetaTileEntity()) return;
}
mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
mConnections = (byte) ((mConnections & ~64) | -128);
} }
} }
case 8: mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
tCode = 9; if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
mMetaTileEntity.onPreTick(this, mTickTimer); mConnections = (byte) ((mConnections & ~64) | -128);
if (!hasValidMetaTileEntity()) return; }
case 9: }}
tCode++; //case 8:
if (isServerSide()) { if (tCode == 8) {
if (mTickTimer == 10) { tCode = 9;
for (byte i = 0; i < 6; i++) mMetaTileEntity.onPreTick(this, mTickTimer);
mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]); if (!hasValidMetaTileEntity()) return;}
issueBlockUpdate(); //case 9:
} if (tCode == 9) {
tCode++;
if (isServerSide()) {
if (mTickTimer == 10) {
for (byte i = 0; i < 6; i++)
mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
issueBlockUpdate();
}
if (xCoord != oX || yCoord != oY || zCoord != oZ) { if (xCoord != oX || yCoord != oY || zCoord != oZ) {
oX = xCoord; oX = xCoord;
oY = yCoord; oY = yCoord;
oZ = zCoord; oZ = zCoord;
issueClientUpdate(); issueClientUpdate();
clearTileEntityBuffer(); clearTileEntityBuffer();
} }
}}
//case 10:
if (tCode == 10) {
tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) return;}
//case 11:
if (tCode == 11) {
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
mSendClientData = false;
} }
case 10: }
tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) return;
case 11:
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = mConnections, oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
mSendClientData = false;
}
}
if (mTickTimer > 10) { if (mTickTimer > 10) {
if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections); if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections);
byte tData = mMetaTileEntity.getUpdateData(); byte tData = mMetaTileEntity.getUpdateData();
if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData); if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor); if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)); tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData); if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
} }
if (mNeedsBlockUpdate) { if (mNeedsBlockUpdate) {
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0)); worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
mNeedsBlockUpdate = false; mNeedsBlockUpdate = false;
} }
} }}
default: //default:
tCode = -1; if (tCode > 11) {
break; tCode = -1;
} break;}
} catch (Throwable e) { //}
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!!!"); }} catch (Throwable e) {
e.printStackTrace(GT_Log.err); 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);
} }
if (isServerSide() && hasValidMetaTileEntity()) { if (isServerSide() && hasValidMetaTileEntity()) {

View file

@ -250,38 +250,270 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mRunningThroughTick = true; mRunningThroughTick = true;
long tTime = System.currentTimeMillis(); long tTime = System.currentTimeMillis();
int tCode = 0;
for (int tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) { try { for (tCode = 0; hasValidMetaTileEntity() && tCode >= 0; ) {
try { //replace switch in if
switch (tCode) { //switch (tCode) {
case 0: //case 0:
tCode++; if (tCode == 0) {
if (mTickTimer++ == 0) { tCode++;
oX = xCoord; if (mTickTimer++ == 0) {
oY = yCoord; oX = xCoord;
oZ = zCoord; oY = yCoord;
if (isServerSide()) for (byte i = 0; i < 6; i++) oZ = zCoord;
if (getCoverIDAtSide(i) != 0) if (isServerSide()) for (byte i = 0; i < 6; i++)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i)))) if (getCoverIDAtSide(i) != 0)
dropCover(i, i, true); if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
dropCover(i, i, true);
worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this); worldObj.markTileEntityChunkModified(xCoord, yCoord, zCoord, this);
mMetaTileEntity.onFirstTick(this);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}}
//case 1:
if (tCode == 1) {
tCode++;
if (isClientSide()) {
if (mColor != oColor) {
mMetaTileEntity.onColorChangeClient(oColor = mColor);
issueTextureUpdate();
}
if (mLightValue != oLightValueClient) {
worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
oLightValueClient = mLightValue;
issueTextureUpdate();
}
if (mNeedsUpdate) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
//worldObj.func_147479_m(xCoord, yCoord, zCoord);
mNeedsUpdate = false;
}
}}
/*case 2:
case 3:
case 4:
case 5:
case 6:
case 7:*/
if (tCode >= 2 && tCode <= 7) {
if (isServerSide() && mTickTimer > 10) {
for (byte i = (byte) (tCode - 2); i < 6; i++)
if (getCoverIDAtSide(i) != 0) {
tCode++;
GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
}
}}
//case 8:
if (tCode == 8) {
tCode = 9;
if (isServerSide()) {
if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0;
if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0;
mAverageEUInput[mAverageEUInputIndex] = 0;
mAverageEUOutput[mAverageEUOutputIndex] = 0;
}}
//case 9:
if (tCode == 9) {
tCode++;
mMetaTileEntity.onPreTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}}
//case 10:
if (tCode == 10) {
tCode++;
if (isServerSide()) {
if (mRedstone != oRedstone || mTickTimer == 10) {
for (byte i = 0; i < 6; i++)
mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
oRedstone = mRedstone;
issueBlockUpdate();
}
if (xCoord != oX || yCoord != oY || zCoord != oZ) {
oX = xCoord;
oY = yCoord;
oZ = zCoord;
issueClientUpdate();
clearTileEntityBuffer();
}
if (mFacing != oFacing) {
oFacing = mFacing;
for (byte i = 0; i < 6; i++)
if (getCoverIDAtSide(i) != 0)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
dropCover(i, i, true);
issueBlockUpdate();
}
if (mTickTimer > 20 && mMetaTileEntity.isElectric()) {
mAcceptedAmperes = 0;
if (getOutputVoltage() != oOutput) {
oOutput = getOutputVoltage();
}
if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) {
for (byte i = 0; i < 6; i++) {
boolean
temp = isEnergyInputSide(i);
if (temp != mActiveEUInputs[i]) {
mActiveEUInputs[i] = temp;
}
temp = isEnergyOutputSide(i);
if (temp != mActiveEUOutputs[i]) {
mActiveEUOutputs[i] = temp;
}
}
}
if (mMetaTileEntity.isEnetOutput() && oOutput > 0) {
long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage);
if (tUsableAmperage > 0) {
long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
mAverageEUOutput[mAverageEUOutputIndex] += tEU;
decreaseStoredEU(tEU, true);
}
}
if (getEUCapacity() > 0) {
if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) {
Block tBlock = getBlockAtSide((byte) getRandomNumber(6));
if (tBlock instanceof BlockFire) doEnergyExplosion();
}
mMetaTileEntity.onFirstTick(this);
if (!hasValidMetaTileEntity()) { if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false; mRunningThroughTick = false;
return; return;
} }
}
case 1:
tCode++;
if (isClientSide()) {
if (mColor != oColor) {
mMetaTileEntity.onColorChangeClient(oColor = mColor);
issueTextureUpdate();
}
if (mLightValue != oLightValueClient) { if (getRandomNumber(1000) == 0) {
if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
|| (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord)
|| (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord)
|| (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord)
|| (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
if (getRandomNumber(10) == 0) {
//try {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
//} catch (Exception e) {
//}
doEnergyExplosion();
} else setOnFire();
}
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
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();
}
}
}
}
}
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
//case 11:
if (tCode == 11) {
tCode++;
if (isServerSide()) {
if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
dischargeItem(mMetaTileEntity.mInventory[i]);
if (mMetaTileEntity.mInventory[i].stackSize <= 0)
mMetaTileEntity.mInventory[i] = null;
mInventoryChanged = true;
}
}
}
}}
//case 12:
if (tCode == 12) {
tCode++;
if (isServerSide()) {
if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
chargeItem(mMetaTileEntity.mInventory[i]);
if (mMetaTileEntity.mInventory[i].stackSize <= 0)
mMetaTileEntity.mInventory[i] = null;
mInventoryChanged = true;
}
}
}
}}
//case 13:
if (tCode == 13) {
tCode++;
updateStatus();
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}}
//case 14:
if (tCode == 14) {
tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}}
//case 15:
if (tCode == 15) {
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
mSendClientData = false;
}
}
if (mTickTimer > 10) {
byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
tData = mMetaTileEntity.getUpdateData();
if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
if (mLightValue != oLightValue) {
worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue); worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord); worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
@ -290,250 +522,24 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord); worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1); worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1); worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
oLightValueClient = mLightValue;
issueTextureUpdate(); issueTextureUpdate();
} sendBlockEvent((byte) 7, oLightValue = mLightValue);
if (mNeedsUpdate) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
//worldObj.func_147479_m(xCoord, yCoord, zCoord);
mNeedsUpdate = false;
} }
} }
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) {
tCode++;
GT_CoverBehavior tCover = getCoverBehaviorAtSide(i);
int tCoverTickRate = tCover.getTickRate(i, getCoverIDAtSide(i), mCoverData[i], this);
if (tCoverTickRate > 0 && mTickTimer % tCoverTickRate == 0) {
mCoverData[i] = tCover.doCoverThings(i, getInputRedstoneSignal(i), getCoverIDAtSide(i), mCoverData[i], this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
}
if (mNeedsBlockUpdate) {
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
mNeedsBlockUpdate = false;
} }
case 8: }}
tCode = 9; //default:
if (isServerSide()) { if (tCode > 15) {
if (++mAverageEUInputIndex >= mAverageEUInput.length) mAverageEUInputIndex = 0; tCode = -1;
if (++mAverageEUOutputIndex >= mAverageEUOutput.length) mAverageEUOutputIndex = 0; break;}
}}
mAverageEUInput[mAverageEUInputIndex] = 0; } catch (Throwable e) {
mAverageEUOutput[mAverageEUOutputIndex] = 0; 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);
case 9:
tCode++;
mMetaTileEntity.onPreTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
case 10:
tCode++;
if (isServerSide()) {
if (mRedstone != oRedstone || mTickTimer == 10) {
for (byte i = 0; i < 6; i++)
mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
oRedstone = mRedstone;
issueBlockUpdate();
}
if (xCoord != oX || yCoord != oY || zCoord != oZ) {
oX = xCoord;
oY = yCoord;
oZ = zCoord;
issueClientUpdate();
clearTileEntityBuffer();
}
if (mFacing != oFacing) {
oFacing = mFacing;
for (byte i = 0; i < 6; i++)
if (getCoverIDAtSide(i) != 0)
if (!mMetaTileEntity.allowCoverOnSide(i, new GT_ItemStack(getCoverIDAtSide(i))))
dropCover(i, i, true);
issueBlockUpdate();
}
if (mTickTimer > 20 && mMetaTileEntity.isElectric()) {
mAcceptedAmperes = 0;
if (getOutputVoltage() != oOutput) {
oOutput = getOutputVoltage();
}
if (mMetaTileEntity.isEnetOutput() || mMetaTileEntity.isEnetInput()) {
for (byte i = 0; i < 6; i++) {
boolean
temp = isEnergyInputSide(i);
if (temp != mActiveEUInputs[i]) {
mActiveEUInputs[i] = temp;
}
temp = isEnergyOutputSide(i);
if (temp != mActiveEUOutputs[i]) {
mActiveEUOutputs[i] = temp;
}
}
}
if (mMetaTileEntity.isEnetOutput() && oOutput > 0) {
long tOutputVoltage = Math.max(oOutput, oOutput + (1 << GT_Utility.getTier(oOutput))), tUsableAmperage = Math.min(getOutputAmperage(), (getStoredEU() - mMetaTileEntity.getMinimumStoredEU()) / tOutputVoltage);
if (tUsableAmperage > 0) {
long tEU = tOutputVoltage * IEnergyConnected.Util.emitEnergyToNetwork(oOutput, tUsableAmperage, this);
mAverageEUOutput[mAverageEUOutputIndex] += tEU;
decreaseStoredEU(tEU, true);
}
}
if (getEUCapacity() > 0) {
if (GregTech_API.sMachineFireExplosions && getRandomNumber(1000) == 0) {
Block tBlock = getBlockAtSide((byte) getRandomNumber(6));
if (tBlock != null && tBlock instanceof BlockFire) doEnergyExplosion();
}
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
if (getRandomNumber(1000) == 0) {
if ((getCoverIDAtSide((byte) 1) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord) - 2 < yCoord)
|| (getCoverIDAtSide((byte) 2) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord - 1) - 1 < yCoord)
|| (getCoverIDAtSide((byte) 3) == 0 && worldObj.getPrecipitationHeight(xCoord, zCoord + 1) - 1 < yCoord)
|| (getCoverIDAtSide((byte) 4) == 0 && worldObj.getPrecipitationHeight(xCoord - 1, zCoord) - 1 < yCoord)
|| (getCoverIDAtSide((byte) 5) == 0 && worldObj.getPrecipitationHeight(xCoord + 1, zCoord) - 1 < yCoord)) {
if (GregTech_API.sMachineRainExplosions && worldObj.isRaining() && getBiome().rainfall > 0) {
if (getRandomNumber(10) == 0) {
//try {
GT_Mod.instance.achievements.issueAchievement(this.getWorldObj().getPlayerEntityByName(mOwnerName), "badweather");
//} catch (Exception e) {
//}
doEnergyExplosion();
} else setOnFire();
}
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
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();
}
}
}
}
}
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
}
case 11:
tCode++;
if (isServerSide()) {
if (mMetaTileEntity.dechargerSlotCount() > 0 && getStoredEU() < getEUCapacity()) {
for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
dischargeItem(mMetaTileEntity.mInventory[i]);
if(ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])>0){
if((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]))<getEUCapacity()){
increaseStoredEnergyUnits((long)ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]),false);
mMetaTileEntity.mInventory[i].stackSize--;
}
}
if (mMetaTileEntity.mInventory[i].stackSize <= 0)
mMetaTileEntity.mInventory[i] = null;
mInventoryChanged = true;
}
}
}
}
case 12:
tCode++;
if (isServerSide()) {
if (mMetaTileEntity.rechargerSlotCount() > 0 && getStoredEU() > 0) {
for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
chargeItem(mMetaTileEntity.mInventory[i]);
if (mMetaTileEntity.mInventory[i].stackSize <= 0)
mMetaTileEntity.mInventory[i] = null;
mInventoryChanged = true;
}
}
}
}
case 13:
tCode++;
updateStatus();
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
case 14:
tCode++;
mMetaTileEntity.onPostTick(this, mTickTimer);
if (!hasValidMetaTileEntity()) {
mRunningThroughTick = false;
return;
}
case 15:
tCode++;
if (isServerSide()) {
if (mTickTimer % 10 == 0) {
if (mSendClientData) {
NW.sendPacketToAllPlayersInRange(worldObj, new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID, mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5], oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)), oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0, oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)), oColor = mColor), xCoord, zCoord);
mSendClientData = false;
}
}
if (mTickTimer > 10) {
byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
tData = mMetaTileEntity.getUpdateData();
if (tData != oUpdateData) sendBlockEvent((byte) 1, oUpdateData = tData);
if (mColor != oColor) sendBlockEvent((byte) 2, oColor = mColor);
tData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0));
if (tData != oRedstoneData) sendBlockEvent((byte) 3, oRedstoneData = tData);
if (mLightValue != oLightValue) {
worldObj.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, mLightValue);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord + 1, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord - 1, yCoord, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord + 1, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord - 1, zCoord);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord + 1);
worldObj.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord - 1);
issueTextureUpdate();
sendBlockEvent((byte) 7, oLightValue = mLightValue);
}
}
if (mNeedsBlockUpdate) {
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
mNeedsBlockUpdate = false;
}
}
default:
tCode = -1;
break;
}
} catch (Throwable e) {
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);
}
} }
if (isServerSide() && hasValidMetaTileEntity()) { if (isServerSide() && hasValidMetaTileEntity()) {
@ -595,7 +601,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mFacing = (byte) (aValue & 7); mFacing = (byte) (aValue & 7);
mActive = ((aValue & 8) != 0); mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0); mRedstone = ((aValue & 16) != 0);
// mLockUpgrade = ((aValue&32) != 0); //mLockUpgrade = ((aValue&32) != 0);
break; break;
case 1: case 1:
if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue); if (hasValidMetaTileEntity()) mMetaTileEntity.onValueUpdate((byte) aValue);
@ -1083,8 +1089,8 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) { public boolean playerOwnsThis(EntityPlayer aPlayer, boolean aCheckPrecicely) {
if (!canAccessData()) return false; if (!canAccessData()) return false;
if (aCheckPrecicely || privateAccess() || mOwnerName.equals("")) if (aCheckPrecicely || privateAccess() || (mOwnerName.length() == 0))
if (mOwnerName.equals("") && isServerSide()) setOwnerName(aPlayer.getDisplayName()); if ((mOwnerName.length() == 0) && isServerSide()) setOwnerName(aPlayer.getDisplayName());
else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName())) else if (privateAccess() && !aPlayer.getDisplayName().equals("Player") && !mOwnerName.equals("Player") && !mOwnerName.equals(aPlayer.getDisplayName()))
return false; return false;
return true; return true;
@ -1110,7 +1116,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try { try {
mReleaseEnergy = true; mReleaseEnergy = true;
IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this); IEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);
} catch (Exception e) {/* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */} } catch (Exception e) {
/* Fun Fact: all these "do nothing" Comments you see in my Code, are just there to let Eclipse shut up about the intended empty Brackets, but I need eclipse to yell at me in some of the regular Cases where I forget to add Code */
GT_Log.out.println("mReleaseEnergy = true;\nIEnergyConnected.Util.emitEnergyToNetwork(V[5], Math.max(1, getStoredEU() / V[5]), this);");
}
} }
mReleaseEnergy = false; mReleaseEnergy = false;
// Normal Explosion Code // Normal Explosion Code
@ -1359,6 +1368,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
@Override @Override
public byte getOutputRedstoneSignal(byte aSide) { public byte getOutputRedstoneSignal(byte aSide) {
return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : 0; return getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) ? mSidedRedstone[aSide] : 0;
// return (byte)(getCoverBehaviorAtSide(aSide).manipulatesSidedRedstoneOutput(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this) || (mRedstone && getCoverBehaviorAtSide(aSide).letsRedstoneGoOut(aSide, getCoverIDAtSide(aSide), getCoverDataAtSide(aSide), this))?mSidedRedstone[aSide]&15:0);
} }
@Override @Override

View file

@ -894,7 +894,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler {
if ((aEvent.entityPlayer == null) || (aEvent.entityPlayer.worldObj == null) || (aEvent.action == null) || (aEvent.world.provider == null)) { if ((aEvent.entityPlayer == null) || (aEvent.entityPlayer.worldObj == null) || (aEvent.action == null) || (aEvent.world.provider == null)) {
return; return;
} }
if ((!aEvent.entityPlayer.worldObj.isRemote) && (aEvent.action != null) && (aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR) if ((!aEvent.entityPlayer.worldObj.isRemote) && (aEvent.action != PlayerInteractEvent.Action.RIGHT_CLICK_AIR)
&& (GT_Log.pal != null)) { && (GT_Log.pal != null)) {
this.mBufferedPlayerActivity.add(getDataAndTime() + ";" + aEvent.action.name() + ";" + aEvent.entityPlayer.getDisplayName() + ";DIM:" this.mBufferedPlayerActivity.add(getDataAndTime() + ";" + aEvent.action.name() + ";" + aEvent.entityPlayer.getDisplayName() + ";DIM:"
+ aEvent.world.provider.dimensionId + ";" + aEvent.x + ";" + aEvent.y + ";" + aEvent.z + ";|;" + aEvent.x / 10 + ";" + aEvent.y / 10 + ";" + aEvent.world.provider.dimensionId + ";" + aEvent.x + ";" + aEvent.y + ";" + aEvent.z + ";|;" + aEvent.x / 10 + ";" + aEvent.y / 10 + ";"

View file

@ -38,7 +38,7 @@ public class GT_Item_Machines
aList.add("IF YOU GOT IT IN SURVIVAL THEN PLEASE REPORT IT"); aList.add("IF YOU GOT IT IN SURVIVAL THEN PLEASE REPORT IT");
} else { } else {
TileEntity temp = GregTech_API.sBlockMachines.createTileEntity(aPlayer == null ? GT_Values.DW : aPlayer.worldObj, GregTech_API.METATILEENTITIES[tDamage] == null ? 0 : GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType()); TileEntity temp = GregTech_API.sBlockMachines.createTileEntity(aPlayer == null ? GT_Values.DW : aPlayer.worldObj, GregTech_API.METATILEENTITIES[tDamage] == null ? 0 : GregTech_API.METATILEENTITIES[tDamage].getTileEntityBaseType());
if (temp != null) { //if (temp != null) {
temp.setWorldObj(aPlayer == null ? GT_Values.DW : aPlayer.worldObj); temp.setWorldObj(aPlayer == null ? GT_Values.DW : aPlayer.worldObj);
temp.xCoord = 0; temp.xCoord = 0;
temp.yCoord = 0; temp.yCoord = 0;
@ -67,7 +67,7 @@ public class GT_Item_Machines
aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY); aList.add(GT_LanguageManager.addStringLocalization("TileEntity_EUp_STORE", "Capacity: ", !GregTech_API.sPostloadFinished) + EnumChatFormatting.BLUE + tTileEntity.getEUCapacity() + EnumChatFormatting.GRAY);
} }
} }
} //}
} }
NBTTagCompound aNBT = aStack.getTagCompound(); NBTTagCompound aNBT = aStack.getTagCompound();
if (aNBT != null) { if (aNBT != null) {

View file

@ -24,7 +24,7 @@ public class GT_Cover_Conveyor
} }
TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(aSide); TileEntity tTileEntity = aTileEntity.getTileEntityAtSide(aSide);
//aTileEntity.decreaseStoredEnergyUnits(1L, true); //aTileEntity.decreaseStoredEnergyUnits(1L, true);
if (((aCoverVariable % 2 != 1) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= 128L)) { if (((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= 128L)) {
if (aTileEntity.isUniversalEnergyStored(256L)) { if (aTileEntity.isUniversalEnergyStored(256L)) {
aTileEntity.decreaseStoredEnergyUnits(4 * GT_Utility.moveOneItemStack(aCoverVariable % 2 == 0 ? aTileEntity : tTileEntity, aCoverVariable % 2 != 0 ? aTileEntity : tTileEntity, aCoverVariable % 2 != 0 ? GT_Utility.getOppositeSide(aSide) : aSide, aCoverVariable % 2 == 0 ? GT_Utility.getOppositeSide(aSide) : aSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1), true); aTileEntity.decreaseStoredEnergyUnits(4 * GT_Utility.moveOneItemStack(aCoverVariable % 2 == 0 ? aTileEntity : tTileEntity, aCoverVariable % 2 != 0 ? aTileEntity : tTileEntity, aCoverVariable % 2 != 0 ? GT_Utility.getOppositeSide(aSide) : aSide, aCoverVariable % 2 == 0 ? GT_Utility.getOppositeSide(aSide) : aSide, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1), true);
} }

View file

@ -35,7 +35,7 @@ public class GT_Cover_Pump
tLiquid = tLiquid.copy(); tLiquid = tLiquid.copy();
tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, false); tLiquid.amount = tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid, false);
if (tLiquid.amount > 0) { if (tLiquid.amount > 0) {
if (((aCoverVariable % 2 != 1) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10))) { if (((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10))) {
if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) { if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) {
aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true); aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true);
tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true); tTank2.fill(ForgeDirection.getOrientation(aSide).getOpposite(), tTank1.drain(ForgeDirection.getOrientation(aSide), tLiquid.amount, true), true);
@ -51,7 +51,7 @@ public class GT_Cover_Pump
tLiquid = tLiquid.copy(); tLiquid = tLiquid.copy();
tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false); tLiquid.amount = tTank1.fill(ForgeDirection.getOrientation(aSide), tLiquid, false);
if (tLiquid.amount > 0) { if (tLiquid.amount > 0) {
if (((aCoverVariable % 2 != 1) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10))) { if (((aCoverVariable % 2 == 0) || (aSide != 1)) && ((aCoverVariable % 2 != 0) || (aSide != 0)) && (aTileEntity.getUniversalEnergyCapacity() >= Math.min(1, tLiquid.amount / 10))) {
if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) { if (aTileEntity.isUniversalEnergyStored(Math.min(1, tLiquid.amount / 10))) {
aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true); aTileEntity.decreaseStoredEnergyUnits(Math.min(1, tLiquid.amount / 10), true);
tTank1.fill(ForgeDirection.getOrientation(aSide), tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid.amount, true), true); tTank1.fill(ForgeDirection.getOrientation(aSide), tTank2.drain(ForgeDirection.getOrientation(aSide).getOpposite(), tLiquid.amount, true), true);

View file

@ -34,9 +34,9 @@ public class GT_GUIContainer_FusionReactor extends GT_GUIContainerMetaTile_Machi
fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255); fontRendererObj.drawString("Running perfectly.", 10, 170, 16448255);
} }
} }
if (this.mContainer != null) { //if (this.mContainer != null) {
fontRendererObj.drawString(GT_Utility.formatNumbers(this.mContainer.mEnergy) + " EU", 50, 155, 0x00ff0000); fontRendererObj.drawString(GT_Utility.formatNumbers(this.mContainer.mEnergy) + " EU", 50, 155, 0x00ff0000);
} //}
} }
} }

View file

@ -58,17 +58,17 @@ public class GT_CapeRenderer
bindTexture(tResource); bindTexture(tResource);
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslatef(glf0, glf0, 0.125F); GL11.glTranslatef(glf0, glf0, 0.125F);
double var1f = (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks); float var1f = (float) (aPlayer.prevPosX + (aPlayer.posX - aPlayer.prevPosX) * aPartialTicks);
double d0 = aPlayer.field_71091_bM + var1f; float d0 = (float) aPlayer.field_71091_bM + var1f;
double d1 = aPlayer.field_71096_bN + var1f; float d1 = (float) aPlayer.field_71096_bN + var1f;
double d2 = aPlayer.field_71097_bO + var1f; float d2 = (float) aPlayer.field_71097_bO + var1f;
float f6 = aPlayer.prevRenderYawOffset + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks; float f6 = (float) (aPlayer.prevRenderYawOffset + (aPlayer.renderYawOffset - aPlayer.prevRenderYawOffset) * aPartialTicks);
float var2f = f6 * 3.141593F / 180.0F; float var2f = f6 * 3.141593F / 180.0F;
double d3 = MathHelper.sin(var2f); float d3 = MathHelper.sin(var2f);
double d4 = -MathHelper.cos(var2f); float d4 = -MathHelper.cos(var2f);
float f7 = (float) d1 * 10.0F; float f7 = /*(float) */d1 * 10.0F;
float f8 = (float) (d0 * d3 + d2 * d4) * 100.0F; float f8 = /*(float) */(d0 * d3 + d2 * d4) * 100.0F;
float f9 = (float) (d0 * d4 - d2 * d3) * 100.0F; float f9 = /*(float) */(d0 * d4 - d2 * d3) * 100.0F;
if (f7 < -6.0F) { if (f7 < -6.0F) {
f7 = -6.0F; f7 = -6.0F;
} }

View file

@ -16,7 +16,6 @@ import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility; import gregtech.api.util.GT_Utility;
import gregtech.common.items.behaviors.Behaviour_DataOrb; import gregtech.common.items.behaviors.Behaviour_DataOrb;
import gregtech.common.items.behaviors.Behaviour_DataStick;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -207,12 +206,12 @@ public class GT_MetaTileEntity_Scanner
@Override @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (mProgresstime >= (mMaxProgresstime - 1)) { if (mProgresstime >= (mMaxProgresstime - 1)) {
try { //try {
if (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707")) { if (this.mOutputItems[0].getUnlocalizedName().equals("gt.metaitem.01.32707")) {
GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning"); GT_Mod.instance.achievements.issueAchievement(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), "scanning");
} }
} catch (Exception e) { //} catch (Exception e) {
} //}
} }
super.onPostTick(aBaseMetaTileEntity, aTick); super.onPostTick(aBaseMetaTileEntity, aTick);
} }

View file

@ -34,13 +34,13 @@ public class GT_MetaTileEntity_AlloySmelter_Bronze
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs()); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs());
if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
this.mOutputItems[0] = tRecipe.getOutput(0); this.mOutputItems[0] = tRecipe.getOutput(0);
if (tRecipe.mEUt <= 16) { //if (tRecipe.mEUt <= 16) {
this.mEUt = tRecipe.mEUt; this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = (tRecipe.mDuration * 2); this.mMaxProgresstime = (tRecipe.mDuration * 2);
} else { /*} else {
this.mEUt = tRecipe.mEUt; this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = (tRecipe.mDuration * 2); this.mMaxProgresstime = (tRecipe.mDuration * 2);
} }*/
return 2; return 2;
} }
return 0; return 0;

View file

@ -34,13 +34,13 @@ public class GT_MetaTileEntity_AlloySmelter_Steel
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs()); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sAlloySmelterRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs());
if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
this.mOutputItems[0] = tRecipe.getOutput(0); this.mOutputItems[0] = tRecipe.getOutput(0);
if (tRecipe.mEUt <= 16) { //if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * 3); this.mEUt = (tRecipe.mEUt * 3);
this.mMaxProgresstime = tRecipe.mDuration; this.mMaxProgresstime = tRecipe.mDuration;
} else { /*} else {
this.mEUt = (tRecipe.mEUt * 3); this.mEUt = (tRecipe.mEUt * 3);
this.mMaxProgresstime = tRecipe.mDuration; this.mMaxProgresstime = tRecipe.mDuration;
} }*/
return 2; return 2;
} }
return 0; return 0;

View file

@ -34,13 +34,13 @@ public class GT_MetaTileEntity_ForgeHammer_Bronze
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs()); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[1], null, getAllInputs());
if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
this.mOutputItems[0] = tRecipe.getOutput(0); this.mOutputItems[0] = tRecipe.getOutput(0);
if (tRecipe.mEUt <= 16) { //if (tRecipe.mEUt <= 16) {
this.mEUt = tRecipe.mEUt; this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = (tRecipe.mDuration * 2); this.mMaxProgresstime = (tRecipe.mDuration * 2);
} else { /*} else {
this.mEUt = tRecipe.mEUt; this.mEUt = tRecipe.mEUt;
this.mMaxProgresstime = (tRecipe.mDuration * 2); this.mMaxProgresstime = (tRecipe.mDuration * 2);
} }*/
return 2; return 2;
} }
return 0; return 0;

View file

@ -34,13 +34,13 @@ public class GT_MetaTileEntity_ForgeHammer_Steel
GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs()); GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(getBaseMetaTileEntity(), false, gregtech.api.enums.GT_Values.V[2], null, getAllInputs());
if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) { if ((tRecipe != null) && (canOutput(tRecipe.mOutputs)) && (tRecipe.isRecipeInputEqual(true, null, getAllInputs()))) {
this.mOutputItems[0] = tRecipe.getOutput(0); this.mOutputItems[0] = tRecipe.getOutput(0);
if (tRecipe.mEUt <= 16) { //if (tRecipe.mEUt <= 16) {
this.mEUt = (tRecipe.mEUt * 3); this.mEUt = (tRecipe.mEUt * 3);
this.mMaxProgresstime = tRecipe.mDuration; this.mMaxProgresstime = tRecipe.mDuration;
} else { /*} else {
this.mEUt = (tRecipe.mEUt * 3); this.mEUt = (tRecipe.mEUt * 3);
this.mMaxProgresstime = tRecipe.mDuration; this.mMaxProgresstime = tRecipe.mDuration;
} }*/
return 2; return 2;
} }
return 0; return 0;

View file

@ -80,7 +80,7 @@ public class GT_Tool_Axe
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return ((tTool != null) && (tTool.equals("axe"))) || (aBlock.getMaterial() == Material.wood); return (/*(tTool != null) && */(tTool.equals("axe"))) || (aBlock.getMaterial() == Material.wood);
} }
public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) {

View file

@ -60,7 +60,7 @@ public class GT_Tool_BranchCutter
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return ((tTool != null) && (tTool.equals("grafter"))) || (aBlock.getMaterial() == Material.leaves); return (/*(tTool != null) && */(tTool.equals("grafter"))) || (aBlock.getMaterial() == Material.leaves);
} }
public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {

View file

@ -75,7 +75,7 @@ public class GT_Tool_File
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return (tTool != null) && (tTool.equals("file")); return /*(tTool != null) && */(tTool.equals("file"));
} }
public ItemStack getBrokenItem(ItemStack aStack) { public ItemStack getBrokenItem(ItemStack aStack) {

View file

@ -31,7 +31,7 @@ public class GT_Tool_Plow
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return ((tTool != null) && (tTool.equals("plow"))) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.craftedSnow); return (/*(tTool != null) && */(tTool.equals("plow"))) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.craftedSnow);
} }
public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) {

View file

@ -43,7 +43,7 @@ public class GT_Tool_Plunger
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return (tTool != null) && (tTool.equals("plunger")); return /*(tTool != null) && */(tTool.equals("plunger"));
} }
public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) {

View file

@ -31,7 +31,7 @@ public class GT_Tool_Sense
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return ((tTool != null) && ((tTool.equals("sense")) || (tTool.equals("scythe")))) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.leaves); return (/*(tTool != null) && */((tTool.equals("sense")) || (tTool.equals("scythe")))) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.leaves);
} }
public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) { public int convertBlockDrops(List<ItemStack> aDrops, ItemStack aStack, EntityPlayer aPlayer, Block aBlock, int aX, int aY, int aZ, byte aMetaData, int aFortune, boolean aSilkTouch, BlockEvent.HarvestDropsEvent aEvent) {

View file

@ -84,7 +84,7 @@ public class GT_Tool_SoftHammer
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return (tTool != null) && (tTool.equals("softhammer")); return /*(tTool != null) && */(tTool.equals("softhammer"));
} }
public ItemStack getBrokenItem(ItemStack aStack) { public ItemStack getBrokenItem(ItemStack aStack) {

View file

@ -79,7 +79,7 @@ public class GT_Tool_UniversalSpade
public boolean isMinableBlock(Block aBlock, byte aMetaData) { public boolean isMinableBlock(Block aBlock, byte aMetaData) {
String tTool = aBlock.getHarvestTool(aMetaData); String tTool = aBlock.getHarvestTool(aMetaData);
return ((tTool != null) && ((tTool.equals("shovel")) || (tTool.equals("axe")) || (tTool.equals("saw")) || (tTool.equals("sword")) || (tTool.equals("crowbar")))) || (aBlock.getMaterial() == Material.sand) || (aBlock.getMaterial() == Material.grass) || (aBlock.getMaterial() == Material.ground) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.clay) || (aBlock.getMaterial() == Material.leaves) || (aBlock.getMaterial() == Material.vine) || (aBlock.getMaterial() == Material.wood) || (aBlock.getMaterial() == Material.cactus) || (aBlock.getMaterial() == Material.circuits) || (aBlock.getMaterial() == Material.gourd) || (aBlock.getMaterial() == Material.web) || (aBlock.getMaterial() == Material.cloth) || (aBlock.getMaterial() == Material.carpet) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.cake) || (aBlock.getMaterial() == Material.tnt) || (aBlock.getMaterial() == Material.sponge); return (/*(tTool != null) && */((tTool.equals("shovel")) || (tTool.equals("axe")) || (tTool.equals("saw")) || (tTool.equals("sword")) || (tTool.equals("crowbar")))) || (aBlock.getMaterial() == Material.sand) || (aBlock.getMaterial() == Material.grass) || (aBlock.getMaterial() == Material.ground) || (aBlock.getMaterial() == Material.snow) || (aBlock.getMaterial() == Material.clay) || (aBlock.getMaterial() == Material.leaves) || (aBlock.getMaterial() == Material.vine) || (aBlock.getMaterial() == Material.wood) || (aBlock.getMaterial() == Material.cactus) || (aBlock.getMaterial() == Material.circuits) || (aBlock.getMaterial() == Material.gourd) || (aBlock.getMaterial() == Material.web) || (aBlock.getMaterial() == Material.cloth) || (aBlock.getMaterial() == Material.carpet) || (aBlock.getMaterial() == Material.plants) || (aBlock.getMaterial() == Material.cake) || (aBlock.getMaterial() == Material.tnt) || (aBlock.getMaterial() == Material.sponge);
} }
public ItemStack getBrokenItem(ItemStack aStack) { public ItemStack getBrokenItem(ItemStack aStack) {