aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity')
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java153
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java29
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java28
-rw-r--r--src/main/java/gregtech/api/metatileentity/MetaTileEntity.java26
-rw-r--r--src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java66
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java24
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java31
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java18
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java19
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java92
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java23
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java6
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java7
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java100
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java61
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java6
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java2
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java150
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java3
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java22
23 files changed, 607 insertions, 271 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
index 01ca8c0f7b..1f91f30c59 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaPipeEntity.java
@@ -20,6 +20,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.Fluid;
@@ -57,7 +58,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
try {
super.writeToNBT(aNBT);
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
try {
@@ -70,7 +71,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
aNBT.setByte("mStrongRedstone", mStrongRedstone);
aNBT.setBoolean("mWorks", !mWorks);
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
try {
@@ -90,12 +91,12 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
try {
mMetaTileEntity.saveNBTData(aNBT);
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -142,7 +143,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
try {
mMetaTileEntity.loadNBTData(aNBT);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -204,77 +205,77 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
issueTextureUpdate();
}
- if (mNeedsUpdate) {
- worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
- //worldObj.func_147479_m(xCoord, yCoord, zCoord);
- mNeedsUpdate = false;
+ 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()) return;
+ 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()) return;
+ }
}
+ mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
+ if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
+ mConnections = (byte) ((mConnections & ~64) | -128);
}
- mConnections = (byte) (mMetaTileEntity.mConnections | (mConnections & ~63));
- if ((mConnections & -64) == 64 && getRandomNumber(1000) == 0) {
- mConnections = (byte) ((mConnections & ~64) | -128);
- }
- }
- case 8:
- tCode = 9;
- mMetaTileEntity.onPreTick(this, mTickTimer);
- if (!hasValidMetaTileEntity()) return;
- case 9:
- tCode++;
- if (isServerSide()) {
- if (mTickTimer == 10) {
- for (byte i = 0; i < 6; i++)
- mCoverBehaviors[i] = GregTech_API.getCoverBehavior(mCoverSides[i]);
- issueBlockUpdate();
}
+ case 8:
+ tCode = 9;
+ mMetaTileEntity.onPreTick(this, mTickTimer);
+ if (!hasValidMetaTileEntity()) return;
+ case 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) {
- oX = xCoord;
- oY = yCoord;
- oZ = zCoord;
- issueClientUpdate();
- clearTileEntityBuffer();
- }
- }
- 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 (xCoord != oX || yCoord != oY || zCoord != oZ) {
+ oX = xCoord;
+ oY = yCoord;
+ oZ = zCoord;
+ issueClientUpdate();
+ clearTileEntityBuffer();
}
}
+ 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 (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections);
- byte 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 (mTickTimer > 10) {
+ if (mConnections != oTextureData) sendBlockEvent((byte) 0, oTextureData = mConnections);
+ byte 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 (mNeedsBlockUpdate) {
worldObj.notifyBlocksOfNeighborChange(xCoord, yCoord, zCoord, getBlockOffset(0, 0, 0));
@@ -338,7 +339,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
try {
mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -384,18 +385,18 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
ArrayList<String> tList = new ArrayList<String>();
if (aLogLevel > 2) {
- tList.add("Meta-ID: " + mID + (hasValidMetaTileEntity() ? " valid" : " invalid") + (mMetaTileEntity == null ? " MetaTileEntity == null!" : " "));
+ tList.add("Meta-ID: " + EnumChatFormatting.BLUE+ mID +EnumChatFormatting.RESET + (hasValidMetaTileEntity() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " "));
}
if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
double tAverageTime = 0;
for (int tTime : mTimeStatistics) tAverageTime += tTime;
- tList.add("This particular TileEntity has caused an average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms over the last " + mTimeStatistics.length + " ticks.");
+ tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms since " + mTimeStatistics.length + " ticks.");
}
if (mLagWarningCount > 0) {
- tList.add("This TileEntity has also caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
+ tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
}
- tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you");
+ tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED+" not "+EnumChatFormatting.RESET) + "accessible for you");
}
return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
}
@@ -855,7 +856,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
try {
if (hasValidMetaTileEntity()) return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
@@ -867,7 +868,7 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
try {
if (aPlayer != null && hasValidMetaTileEntity()) mMetaTileEntity.onLeftclick(this, aPlayer);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -1312,4 +1313,4 @@ public class BaseMetaPipeEntity extends BaseTileEntity implements IGregTechTileE
public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity collider) {
mMetaTileEntity.onEntityCollidedWithBlock(aWorld, aX, aY, aZ, collider);
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 4aa49a954c..a16768850f 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -26,6 +26,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.Packet;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.ChunkPosition;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
@@ -94,7 +95,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
super.writeToNBT(aNBT);
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
try {
@@ -121,7 +122,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
aNBT.setBoolean("mOutputDisabled", mOutputDisabled);
aNBT.setTag("GT.CraftingComponents", mRecipeStuff);
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
try {
@@ -141,12 +142,12 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
mMetaTileEntity.saveNBTData(aNBT);
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
} catch (Throwable e) {
- GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered CRITICAL ERROR while saving MetaTileEntity, the Chunk whould've been corrupted by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -211,7 +212,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
mMetaTileEntity.loadNBTData(aNBT);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while loading MetaTileEntity, the Server should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -599,7 +600,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
mMetaTileEntity.receiveClientEvent((byte) aEventID, (byte) aValue);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while receiving Data from the Server, the Client should've been crashed by now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
@@ -651,25 +652,25 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
public ArrayList<String> getDebugInfo(EntityPlayer aPlayer, int aLogLevel) {
ArrayList<String> tList = new ArrayList<String>();
if (aLogLevel > 2) {
- tList.add("Meta-ID: " + mID + (canAccessData() ? " valid" : " invalid") + (mMetaTileEntity == null ? " MetaTileEntity == null!" : " "));
+ tList.add("Meta-ID: " +EnumChatFormatting.BLUE+ mID +EnumChatFormatting.RESET + (canAccessData() ? EnumChatFormatting.GREEN+" valid"+EnumChatFormatting.RESET : EnumChatFormatting.RED+" invalid"+EnumChatFormatting.RESET) + (mMetaTileEntity == null ? EnumChatFormatting.RED+" MetaTileEntity == null!"+EnumChatFormatting.RESET : " "));
}
if (aLogLevel > 1) {
if (mTimeStatistics.length > 0) {
double tAverageTime = 0;
for (int tTime : mTimeStatistics) tAverageTime += tTime;
- tList.add("This particular TileEntity has caused an average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms over the last " + mTimeStatistics.length + " ticks.");
+ tList.add("Average CPU-load of ~" + (tAverageTime / mTimeStatistics.length) + "ms since " + mTimeStatistics.length + " ticks.");
}
if (mLagWarningCount > 0) {
- tList.add("This TileEntity has also caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
+ tList.add("Caused " + (mLagWarningCount >= 10 ? "more than 10" : mLagWarningCount) + " Lag Spike Warnings (anything taking longer than " + GregTech_API.MILLISECOND_THRESHOLD_UNTIL_LAG_WARNING + "ms) on the Server.");
}
- tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : " not ") + "accessible for you");
+ tList.add("Is" + (mMetaTileEntity.isAccessAllowed(aPlayer) ? " " : EnumChatFormatting.RED+" not "+EnumChatFormatting.RESET) + "accessible for you");
}
if (aLogLevel > 0) {
if (getSteamCapacity() > 0 && hasSteamEngineUpgrade())
tList.add(getStoredSteam() + " of " + getSteamCapacity() + " Steam");
- tList.add("Machine is " + (mActive ? "active" : "inactive"));
+ tList.add("Machine is " + (mActive ? EnumChatFormatting.GREEN+"active"+EnumChatFormatting.RESET : EnumChatFormatting.RED+"inactive"+EnumChatFormatting.RESET));
if (!mHasEnoughEnergy)
- tList.add("ATTENTION: This Device consumes Energy at a higher Rate than you input. You could insert more to speed up the process.");
+ tList.add(EnumChatFormatting.RED+"ATTENTION: This Device needs more power."+EnumChatFormatting.RESET);
}
return mMetaTileEntity.getSpecialDebugInfo(this, aPlayer, aLogLevel, tList);
}
@@ -1321,7 +1322,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
if (hasValidMetaTileEntity()) return mMetaTileEntity.onRightclick(this, aPlayer, aSide, aX, aY, aZ);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while rightclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
@@ -1333,7 +1334,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
try {
if (aPlayer != null && hasValidMetaTileEntity()) mMetaTileEntity.onLeftclick(this, aPlayer);
} catch (Throwable e) {
- GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immidietly to GregTech Intergalactical!!!");
+ GT_Log.err.println("Encountered Exception while leftclicking TileEntity, the Game should've crashed now, but I prevented that. Please report immediately to GregTech Intergalactical!!!");
e.printStackTrace(GT_Log.err);
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
index b34483c31b..0182052f71 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaPipeEntity.java
@@ -2,6 +2,7 @@ package gregtech.api.metatileentity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -9,6 +10,7 @@ import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Pollution;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -20,6 +22,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.ChunkPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -167,7 +170,7 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {
tCovered = true;
}
//System.out.println("Cover: "+mBaseMetaTileEntity.getCoverIDAtSide(aSide));
- //toDo: filter cover ids that actually protect against temperature (rubber/plastic maybe?)
+ //toDo: filter cover ids that actually protect against temperature (rubber/plastic maybe?, more like asbestos)
return tCovered;
}
@@ -640,11 +643,32 @@ public abstract class MetaPipeEntity implements IMetaTileEntity {
@Override
public void doExplosion(long aExplosionPower) {
- float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F;
+ float tStrength =
+ aExplosionPower < V[0] ? 1.0F :
+ aExplosionPower < V[1] ? 2.0F :
+ aExplosionPower < V[2] ? 3.0F :
+ aExplosionPower < V[3] ? 4.0F :
+ aExplosionPower < V[4] ? 5.0F :
+ aExplosionPower < V[4] * 2 ? 6.0F :
+ aExplosionPower < V[5] ? 7.0F :
+ aExplosionPower < V[6] ? 8.0F :
+ aExplosionPower < V[7] ? 9.0F :
+ aExplosionPower < V[8] ? 10.0F :
+ aExplosionPower < V[8] * 2 ? 11.0F :
+ aExplosionPower < V[9] ? 12.0F :
+ aExplosionPower < V[10] ? 13.0F :
+ aExplosionPower < V[11] ? 14.0F :
+ aExplosionPower < V[12] ? 15.0F :
+ aExplosionPower < V[12] * 2 ? 16.0F :
+ aExplosionPower < V[13] ? 17.0F :
+ aExplosionPower < V[14] ? 18.0F :
+ aExplosionPower < V[15] ? 19.0F : 20.0F;
int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord();
World tWorld = getBaseMetaTileEntity().getWorld();
tWorld.setBlock(tX, tY, tZ, Blocks.air);
if (GregTech_API.sMachineExplosions)
+ if(GT_Mod.gregtechproxy.mPollution)
+ GT_Pollution.addPollution(new ChunkPosition(tX, tY, tZ), 100000);
tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);
}
diff --git a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
index 662dc59d80..3cc96b5058 100644
--- a/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/MetaTileEntity.java
@@ -2,6 +2,7 @@ package gregtech.api.metatileentity;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
@@ -10,6 +11,7 @@ import gregtech.api.util.GT_Config;
import gregtech.api.util.GT_LanguageManager;
import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Pollution;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -20,6 +22,7 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.ChunkPosition;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
@@ -829,12 +832,33 @@ public abstract class MetaTileEntity implements IMetaTileEntity {
@Override
public void doExplosion(long aExplosionPower) {
- float tStrength = aExplosionPower < V[0] ? 1.0F : aExplosionPower < V[1] ? 2.0F : aExplosionPower < V[2] ? 3.0F : aExplosionPower < V[3] ? 4.0F : aExplosionPower < V[4] ? 5.0F : aExplosionPower < V[4] * 2 ? 6.0F : aExplosionPower < V[5] ? 7.0F : aExplosionPower < V[6] ? 8.0F : aExplosionPower < V[7] ? 9.0F : 10.0F;
+ float tStrength =
+ aExplosionPower < V[0] ? 1.0F :
+ aExplosionPower < V[1] ? 2.0F :
+ aExplosionPower < V[2] ? 3.0F :
+ aExplosionPower < V[3] ? 4.0F :
+ aExplosionPower < V[4] ? 5.0F :
+ aExplosionPower < V[4] * 2 ? 6.0F :
+ aExplosionPower < V[5] ? 7.0F :
+ aExplosionPower < V[6] ? 8.0F :
+ aExplosionPower < V[7] ? 9.0F :
+ aExplosionPower < V[8] ? 10.0F :
+ aExplosionPower < V[8] * 2 ? 11.0F :
+ aExplosionPower < V[9] ? 12.0F :
+ aExplosionPower < V[10] ? 13.0F :
+ aExplosionPower < V[11] ? 14.0F :
+ aExplosionPower < V[12] ? 15.0F :
+ aExplosionPower < V[12] * 2 ? 16.0F :
+ aExplosionPower < V[13] ? 17.0F :
+ aExplosionPower < V[14] ? 18.0F :
+ aExplosionPower < V[15] ? 19.0F : 20.0F;
int tX = getBaseMetaTileEntity().getXCoord(), tY = getBaseMetaTileEntity().getYCoord(), tZ = getBaseMetaTileEntity().getZCoord();
World tWorld = getBaseMetaTileEntity().getWorld();
GT_Utility.sendSoundToPlayers(tWorld, GregTech_API.sSoundList.get(209), 1.0F, -1, tX, tY, tZ);
tWorld.setBlock(tX, tY, tZ, Blocks.air);
if (GregTech_API.sMachineExplosions)
+ if(GT_Mod.gregtechproxy.mPollution)
+ GT_Pollution.addPollution(new ChunkPosition(tX, tY, tZ), 100000);
tWorld.createExplosion(null, tX + 0.5, tY + 0.5, tZ + 0.5, tStrength, true);
}
diff --git a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
index 683fe8aab6..305dfa36c0 100644
--- a/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
+++ b/src/main/java/gregtech/api/metatileentity/examples/GT_MetaTileEntity_E_Furnace.java
@@ -31,11 +31,11 @@ public class GT_MetaTileEntity_E_Furnace extends GT_MetaTileEntity_BasicMachine
@Override
public int checkRecipe() {
if (null != (mOutputItems[0] = GT_ModHandler.getSmeltingOutput(getInputAt(0), true, getOutputAt(0)))) {
- mEUt = 4 * (1 << (mTier - 1)) * (1 << (mTier - 1));
- mMaxProgresstime = 128 / (1 << (mTier - 1));
- return 2;
+ calculateOverclockedNess(4,128);
+ if(mMaxProgresstime==Integer.MAX_VALUE-1 && mEUt==Integer.MAX_VALUE-1) return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
- return 0;
+ return DID_NOT_FIND_RECIPE;
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
index fdb3c0da8b..2debde31a2 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java
@@ -17,6 +17,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Client;
import ic2.api.energy.tile.IEnergySink;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@@ -38,9 +39,11 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public final Materials mMaterial;
public final long mCableLossPerMeter, mAmperage, mVoltage;
public final boolean mInsulated, mCanShock;
- public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0;
+ public int mTransferredAmperage = 0, mTransferredAmperageLast20 = 0,mTransferredAmperageLast20OK=0,mTransferredAmperageOK=0;
+ public long mTransferredVoltageLast20 = 0, mTransferredVoltage = 0,mTransferredVoltageLast20OK=0,mTransferredVoltageOK=0;
public long mRestRF;
public short mOverheat;
+ public static short mMaxOverheat=(short) (GT_Mod.gregtechproxy.mWireHeatingTicks * 100);
public GT_MetaPipeEntity_Cable(int aID, String aName, String aNameRegional, float aThickNess, Materials aMaterial, long aCableLossPerMeter, long aAmperage, long aVoltage, boolean aInsulated, boolean aCanShock) {
super(aID, aName, aNameRegional, 0);
@@ -80,13 +83,17 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], Dyes.getModulation(aColorIndex, mMaterial.mRGBa) )};
if (aConnected) {
float tThickNess = getThickNess();
- if (tThickNess < 0.37F)
+ if (tThickNess < 0.124F)
+ return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ if (tThickNess < 0.374F)//0.375 x1
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
- if (tThickNess < 0.49F)
+ if (tThickNess < 0.499F)//0.500 x2
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
- if (tThickNess < 0.74F)
+ if (tThickNess < 0.624F)//0.625 x4
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
- if (tThickNess < 0.99F)
+ if (tThickNess < 0.749F)//0.750 x8
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
+ if (tThickNess < 0.874F)//0.825 x12
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
}
@@ -101,8 +108,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
- return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
+ //if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
+ return AxisAlignedBB.getBoundingBox(aX + 0.0625D, aY + 0.0625D, aZ + 0.0625D, aX + 0.9375D, aY + 0.9375D, aZ + 0.9375D);
}
@Override
@@ -175,7 +182,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
} else if (GregTech_API.mOutputRF && tTileEntity instanceof IEnergyReceiver) {
ForgeDirection tDirection = ForgeDirection.getOrientation(i).getOpposite();
- int rfOut = (int) (aVoltage * GregTech_API.mEUtoRF / 100);
+ long rfOUT = aVoltage * GregTech_API.mEUtoRF / 100;
+ int rfOut = rfOUT>Integer.MAX_VALUE ? Integer.MAX_VALUE : (int)rfOUT;
if (((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, true) == rfOut) {
((IEnergyReceiver) tTileEntity).receiveEnergy(tDirection, rfOut, false);
rUsedAmperes++;
@@ -195,24 +203,33 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
}
}
+ mTransferredVoltage=(Math.max(mTransferredVoltage,aVoltage));
mTransferredAmperage += rUsedAmperes;
- mTransferredVoltageLast20 = Math.max(mTransferredVoltageLast20, aVoltage);
+ mTransferredVoltageLast20 = (Math.max(mTransferredVoltageLast20, aVoltage));
mTransferredAmperageLast20 = Math.max(mTransferredAmperageLast20, mTransferredAmperage);
if (aVoltage > mVoltage || mTransferredAmperage > mAmperage) {
- if(mOverheat>GT_Mod.gregtechproxy.mWireHeatingTicks * 100){
- getBaseMetaTileEntity().setToFire();}else{mOverheat +=100;}
+ if(mOverheat>mMaxOverheat)
+ getBaseMetaTileEntity().setToFire();
+ else
+ mOverheat +=100;
return aAmperage;
}
return rUsedAmperes;
+ //Always return amount of used amperes, used all on overheat
}
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
+ mTransferredVoltageOK=mTransferredVoltage;
+ mTransferredVoltage=0;
+ mTransferredAmperageOK=mTransferredAmperage;
mTransferredAmperage = 0;
if(mOverheat>0)mOverheat--;
if (aTick % 20 == 0) {
+ mTransferredVoltageLast20OK=mTransferredVoltageLast20;
mTransferredVoltageLast20 = 0;
+ mTransferredAmperageLast20OK=mTransferredAmperageLast20;
mTransferredAmperageLast20 = 0;
mConnections = 0;
for (byte i = 0, j = 0; i < 6; i++) {
@@ -251,7 +268,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
}
}
}
- }
+ }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
}
@Override
@@ -275,6 +292,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public float getThickNess() {
+ if(GT_Client.hideValue==1) return 0.0625F;
return mThickNess;
}
@@ -287,4 +305,28 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
public void loadNBTData(NBTTagCompound aNBT) {
//
}
+
+ @Override
+ public boolean isGivingInformation() {
+ return true;
+ }
+
+ @Override
+ public String[] getInfoData() {
+ return new String[]{
+ //EnumChatFormatting.BLUE + mName + EnumChatFormatting.RESET,
+ "Heat: "+
+ EnumChatFormatting.RED+ mOverheat +EnumChatFormatting.RESET+" / "+EnumChatFormatting.YELLOW+ mMaxOverheat + EnumChatFormatting.RESET,
+ "Max Load (1t):",
+ EnumChatFormatting.GREEN + Integer.toString(mTransferredAmperageOK) + EnumChatFormatting.RESET +" A / "+
+ EnumChatFormatting.YELLOW + Long.toString(mAmperage) + EnumChatFormatting.RESET +" A",
+ "Max EU/p (1t):",
+ EnumChatFormatting.GREEN + Long.toString(mTransferredVoltageOK) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(mVoltage) + EnumChatFormatting.RESET +" EU",
+ "Max Load (20t): "+
+ EnumChatFormatting.GREEN + Integer.toString(mTransferredAmperageLast20OK) + EnumChatFormatting.RESET +" A",
+ "Max EU/p (20t): "+
+ EnumChatFormatting.GREEN + Long.toString(mTransferredVoltageLast20OK) + EnumChatFormatting.RESET +" EU"
+ };
+ }
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
index effff677d7..4a51669824 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java
@@ -1,11 +1,7 @@
package gregtech.api.metatileentity.implementations;
import gregtech.api.GregTech_API;
-import gregtech.api.enums.Dyes;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
-import gregtech.api.enums.SubTag;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.ICoverable;
@@ -16,6 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Client;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@@ -74,13 +71,15 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) {
if (aConnected) {
float tThickNess = getThickNess();
- if (tThickNess < 0.37F)
+ if (tThickNess < 0.124F)
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
+ if (tThickNess < 0.374F)//0.375
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
- if (tThickNess < 0.49F)
+ if (tThickNess < 0.499F)//0.500
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
- if (tThickNess < 0.74F)
+ if (tThickNess < 0.749F)//0.750
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
- if (tThickNess < 0.99F)
+ if (tThickNess < 0.874F)//0.825
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
}
@@ -143,7 +142,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
- return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
+ return AxisAlignedBB.getBoundingBox(aX + 0.0625D, aY + 0.0625D, aZ + 0.0625D, aX + 0.9375D, aY + 0.9375D, aZ + 0.9375D);
}
@Override
@@ -269,7 +268,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
}
oLastReceivedFrom = mLastReceivedFrom;
- }
+ }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
}
@Override
@@ -386,6 +385,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override
public float getThickNess() {
+ if(GT_Client.hideValue==1) return 0.0625F;
return mThickNess;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
index e08ae2fb1a..bc0ee194aa 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java
@@ -10,6 +10,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@@ -17,6 +18,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityHopper;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.world.World;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;
@@ -68,17 +71,24 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
}
@Override
+ public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
+ return AxisAlignedBB.getBoundingBox(aX + 0.0625D, aY + 0.0625D, aZ + 0.0625D, aX + 0.9375D, aY + 0.9375D, aZ + 0.9375D);
+ }
+
+ @Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) {
if (mIsRestrictive) {
if (aConnected) {
float tThickNess = getThickNess();
- if (tThickNess < 0.37F)
+ if (tThickNess < 0.124F)
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
+ if (tThickNess < 0.374F)//0.375
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
- if (tThickNess < 0.49F)
+ if (tThickNess < 0.499F)//0.500
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
- if (tThickNess < 0.74F)
+ if (tThickNess < 0.749F)//0.750
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
- if (tThickNess < 0.99F)
+ if (tThickNess < 0.874F)//0.825
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
}
@@ -86,13 +96,15 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
}
if (aConnected) {
float tThickNess = getThickNess();
- if (tThickNess < 0.37F)
+ if (tThickNess < 0.124F)
+ return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
+ if (tThickNess < 0.374F)//0.375
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
- if (tThickNess < 0.49F)
+ if (tThickNess < 0.499F)//0.500
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
- if (tThickNess < 0.74F)
+ if (tThickNess < 0.749F)//0.750
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
- if (tThickNess < 0.99F)
+ if (tThickNess < 0.874F)//0.825
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
}
@@ -217,7 +229,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
if (isInventoryEmpty()) mLastReceivedFrom = 6;
oLastReceivedFrom = mLastReceivedFrom;
- }
+ }else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
}
@Override
@@ -306,6 +318,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override
public float getThickNess() {
+ if(GT_Client.hideValue==1) return 0.0625F;
return mThickNess;
}
} \ No newline at end of file
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java
index 156473749b..539807c848 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java
@@ -13,6 +13,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
import static gregtech.api.enums.GT_Values.V;
@@ -47,7 +48,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
ITexture[][][] rTextures = new ITexture[2][17][];
for (byte i = -1; i < 16; i++) {
rTextures[0][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1]};
- rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
+ rTextures[1][i + 1] = new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][i + 1], mInventory.length==16 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_POWER[mTier] : mInventory.length > 4 ? Textures.BlockIcons.OVERLAYS_ENERGY_OUT_MULTI[mTier] : Textures.BlockIcons.OVERLAYS_ENERGY_OUT[mTier]};
}
return rTextures;
}
@@ -109,12 +110,12 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
@Override
public long getMinimumStoredEU() {
- return V[mTier] * 16 * mInventory.length;
+ return V[mTier] * 16L * mInventory.length;
}
@Override
public long maxEUStore() {
- return V[mTier] * 64 * mInventory.length;
+ return V[mTier] * 64L * mInventory.length;
}
@Override
@@ -129,7 +130,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
@Override
public long maxAmperesIn() {
- return mChargeableCount * 2;
+ return mChargeableCount * 2L;
}
@Override
@@ -309,14 +310,15 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
}
return new String[]{
- getLocalName(),
+ EnumChatFormatting.BLUE+getLocalName()+EnumChatFormatting.RESET,
"Stored Items:",
- GT_Utility.formatNumbers(mStored) + " EU /",
- GT_Utility.formatNumbers(mMax) + " EU"};
+ EnumChatFormatting.GREEN+GT_Utility.formatNumbers(mStored) +EnumChatFormatting.RESET+ " EU / "+
+ EnumChatFormatting.YELLOW+GT_Utility.formatNumbers(mMax) +EnumChatFormatting.RESET+ " EU"
+ };
}
@Override
public boolean isGivingInformation() {
return true;
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
index bd5b8d9ea6..731b6ab977 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicGenerator.java
@@ -5,6 +5,7 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Pollution;
import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
@@ -133,17 +134,18 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
@Override
public long maxEUOutput() {
- return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0;
+ return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier] : 0L;
}
@Override
public long maxEUStore() {
- return Math.max(getEUVar(), V[mTier] * 40 + getMinimumStoredEU());
+ return Math.max(getEUVar(), V[mTier] * 40L + getMinimumStoredEU());
}
@Override
public boolean doesFillContainers() {
- return getBaseMetaTileEntity().isAllowedToWork();
+ //return getBaseMetaTileEntity().isAllowedToWork();
+ return false;
}
@Override
@@ -177,6 +179,12 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
@Override
+ public boolean isLiquidOutput(byte aSide) {
+ //return super.isLiquidOutput(aSide);
+ return false;
+ }
+
+ @Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10 == 0) {
long tProducedEU = 0;
@@ -191,7 +199,8 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
} else {
int tFuelValue = getFuelValue(mFluid), tConsumed = consumedFluidPerOperation(mFluid);
if (tFuelValue > 0 && tConsumed > 0 && mFluid.amount > tConsumed) {
- long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
+ //long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);//TODO CHECK?
+ long tFluidAmountToUse = Math.min(mFluid.amount / tConsumed, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);
if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) {
tProducedEU = tFluidAmountToUse * tFuelValue;
mFluid.amount -= tFluidAmountToUse * tConsumed;
@@ -211,7 +220,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
}
if(tProducedEU>0&&getPollution()>0){
GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()),
- (int) ((tProducedEU * getPollution()/(500*mTier))+1));
+ (int) ((tProducedEU * getPollution()/(250*(mTier+1)))));
}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
index ce17874867..3f171b26b7 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine.java
@@ -21,6 +21,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.DimensionManager;
+import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidHandler;
@@ -199,12 +200,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public long getMinimumStoredEU() {
- return V[mTier] * 16;
+ return V[mTier] * 16L;
}
@Override
public long maxEUStore() {
- return V[mTier] * 64;
+ return V[mTier] * 64L;
}
@Override
@@ -219,7 +220,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public long maxAmperesIn() {
- return (mEUt * 2) / V[mTier] + 1;
+ return ((long)mEUt * 2L) / V[mTier] + 1L;
}
@Override
@@ -426,8 +427,8 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
endProcess();
}
if (mProgresstime > 5) mStuttering = false;
- XSTR aXSTR = new XSTR();
- if(GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord());
+ //XSTR aXSTR = new XSTR();
+ //if(GT_Mod.gregtechproxy.mAprilFool && aXSTR.nextInt(5000)==0)GT_Utility.sendSoundToPlayers(aBaseMetaTileEntity.getWorld(), GregTech_API.sSoundList.get(5), 10.0F, -1.0F, aBaseMetaTileEntity.getXCoord(), aBaseMetaTileEntity.getYCoord(),aBaseMetaTileEntity.getZCoord());
} else {
if (!mStuttering) {
stutterProcess();
@@ -467,7 +468,7 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (allowToCheckRecipe()) {
if (mMaxProgresstime <= 0 && aBaseMetaTileEntity.isAllowedToWork() && (tRemovedOutputFluid || tSucceeded || aBaseMetaTileEntity.hasInventoryBeenModified() || aTick % 600 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled()) && hasEnoughEnergyToCheckRecipe()) {
- if (checkRecipe() == 2) {
+ if (checkRecipe() == FOUND_AND_SUCCESSFULLY_USED_RECIPE) {
if (mInventory[3] != null && mInventory[3].stackSize <= 0) mInventory[3] = null;
for (int i = getInputSlot(), j = i + mInputSlotCount; i < j; i++)
if (mInventory[i] != null && mInventory[i].stackSize <= 0) mInventory[i] = null;
@@ -530,16 +531,46 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
calculateOverclockedNess(aRecipe.mEUt, aRecipe.mDuration);
}
+ /**
+ * Calcualtes overclocked ness using long integers
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ */
protected void calculateOverclockedNess(int aEUt, int aDuration) {
- if (aEUt <= 16) {
- mEUt = aEUt * (1 << (mTier - 1)) * (1 << (mTier - 1));
- mMaxProgresstime = aDuration / (1 << (mTier - 1));
- } else {
- mEUt = aEUt;
+ if(mTier==0){
+ //Long time calculation
+ long xMaxProgresstime = ((long)aDuration)<<1;
+ if(xMaxProgresstime>Integer.MAX_VALUE-1){
+ //make impossible if too long
+ mEUt=Integer.MAX_VALUE-1;
+ mMaxProgresstime=Integer.MAX_VALUE-1;
+ }else{
+ mEUt=aEUt>>2;
+ mMaxProgresstime=(int)xMaxProgresstime;
+ }
+ }else{
+ //Long EUt calculation
+ long xEUt=aEUt;
+ //Isnt too low EUt check?
+ long tempEUt = xEUt<V[1] ? V[1] : xEUt;
+
mMaxProgresstime = aDuration;
- while (mEUt <= V[mTier - 1] * mAmperage) {
- mEUt *= 4;
- mMaxProgresstime /= 2;
+
+ while (tempEUt <= V[mTier -1] * (long)mAmperage) {
+ tempEUt<<=2;//this actually controls overclocking
+ //xEUt *= 4;//this is effect of everclocking
+ mMaxProgresstime>>=1;//this is effect of overclocking
+ xEUt = mMaxProgresstime==0 ? xEUt>>1 : xEUt<<2;//U know, if the time is less than 1 tick make the machine use 2x less power
+ }
+ if(xEUt>Integer.MAX_VALUE-1){
+ mEUt = Integer.MAX_VALUE-1;
+ mMaxProgresstime = Integer.MAX_VALUE-1;
+ }else{
+ mEUt = (int)xEUt;
+ if(mEUt==0)
+ mEUt = 1;
+ if(mMaxProgresstime==0)
+ mMaxProgresstime = 1;//set time to 1 tick
}
}
}
@@ -675,12 +706,17 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
@Override
public String[] getInfoData() {
return new String[]{
- mNEIName,
- "Progress:", (mProgresstime / 20) + " secs",
- (mMaxProgresstime / 20) + " secs",
+ EnumChatFormatting.BLUE + mNEIName + EnumChatFormatting.RESET,
+ "Progress:",
+ EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+
+ EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s",
"Stored Energy:",
- getBaseMetaTileEntity().getStoredEU() + "EU",
- getBaseMetaTileEntity().getEUCapacity() + "EU"};
+ EnumChatFormatting.GREEN + Long.toString(getBaseMetaTileEntity().getStoredEU()) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(getBaseMetaTileEntity().getEUCapacity()) + EnumChatFormatting.RESET +" EU",
+ "Probably uses: " +
+ EnumChatFormatting.RED + Integer.toString(mEUt) + EnumChatFormatting.RESET + " EU/t at " +
+ EnumChatFormatting.RED + Integer.toString(mEUt==0?0:mAmperage) + EnumChatFormatting.RESET +" A"
+ };
}
@Override
@@ -732,6 +768,15 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
* @return see constants above
*/
public int checkRecipe() {
+ return checkRecipe(false);
+ }
+
+ /**
+ *
+ * @param skipOC disables OverclockedNess calculation and check - if you do you must implement your own method...
+ * @return
+ */
+ public int checkRecipe(boolean skipOC){
GT_Recipe_Map tMap = getRecipeList();
if (tMap == null) return DID_NOT_FIND_RECIPE;
GT_Recipe tRecipe = tMap.findRecipe(getBaseMetaTileEntity(), mLastRecipe, false, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), getAllInputs());
@@ -754,7 +799,12 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
if (mOutputItems[i] != null && getBaseMetaTileEntity().getRandomNumber(10000) > mCleanroom.mEfficiency)
mOutputItems[i] = null;
mOutputFluid = tRecipe.getFluidOutput(0);
- calculateOverclockedNess(tRecipe);
+ if(!skipOC){
+ calculateOverclockedNess(tRecipe);
+ //In case recipe is too OP for that machine
+ if (mMaxProgresstime == Integer.MAX_VALUE - 1 && mEUt == Integer.MAX_VALUE - 1)
+ return FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
+ }
return FOUND_AND_SUCCESSFULLY_USED_RECIPE;
}
@@ -813,4 +863,4 @@ public abstract class GT_MetaTileEntity_BasicMachine extends GT_MetaTileEntity_B
public ITexture[] getSideFacingPipeInactive(byte aColor) {
return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColor + 1], new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_PIPE_OUT)};
}
-} \ No newline at end of file
+}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
index 9b0e386df4..4684a4c471 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java
@@ -46,6 +46,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
mGUIParameterA = (byte) aGUIParameterA;
mGUIParameterB = (byte) aGUIParameterB;
+
+ //TODO: CHECK
if (aRecipe != null) {
for (int i = 3; i < aRecipe.length; i++) {
if (aRecipe[i] == X.CIRCUIT) {
@@ -74,6 +76,13 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 6:
case 7:
case 8:
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
aRecipe[i] = Ic2Items.reinforcedGlass;
break;
default:
@@ -111,7 +120,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aRecipe[i] = OrePrefixes.plate.get(Materials.Neutronium);
break;
default:
- aRecipe[i] = OrePrefixes.plate.get(Materials.TungstenSteel);
+ aRecipe[i] = OrePrefixes.plate.get(Materials.Neutronium);
break;
}
continue;
@@ -145,7 +154,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aRecipe[i] = OrePrefixes.pipeLarge.get(Materials.Ultimate);
break;
default:
- aRecipe[i] = OrePrefixes.pipeMedium.get(Materials.TungstenSteel);
+ aRecipe[i] = OrePrefixes.pipeMedium.get(Materials.Ultimate);
break;
}
continue;
@@ -179,7 +188,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aRecipe[i] = OrePrefixes.wireGt02.get(Materials.NaquadahAlloy);
break;
default:
- aRecipe[i] = OrePrefixes.wireGt08.get(Materials.Nichrome);
+ aRecipe[i] = OrePrefixes.wireGt08.get(Materials.NaquadahAlloy);
break;
}
continue;
@@ -213,7 +222,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aRecipe[i] = OrePrefixes.wireGt04.get(Materials.NaquadahAlloy);
break;
default:
- aRecipe[i] = OrePrefixes.wireGt16.get(Materials.Nichrome);
+ aRecipe[i] = OrePrefixes.wireGt16.get(Materials.NaquadahAlloy);
break;
}
continue;
@@ -244,10 +253,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
break;
case 6:
case 7:
- aRecipe[i] = OrePrefixes.stickLong.get(Materials.NeodymiumMagnetic);
+ aRecipe[i] = OrePrefixes.stickLong.get(Materials.Samarium);
break;
default:
- aRecipe[i] = OrePrefixes.block.get(Materials.NeodymiumMagnetic);
+ aRecipe[i] = OrePrefixes.block.get(Materials.Samarium);
break;
}
continue;
@@ -687,5 +696,5 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
return !mSharedTank;
}
- public static enum X {PUMP, WIRE, WIRE4, HULL, PIPE, GLASS, PLATE, MOTOR, ROTOR, SENSOR, PISTON, CIRCUIT, EMITTER, CONVEYOR, ROBOT_ARM, COIL_HEATING, COIL_ELECTRIC, STICK_MAGNETIC, STICK_DISTILLATION, BETTER_CIRCUIT, FIELD_GENERATOR, COIL_HEATING_DOUBLE, STICK_ELECTROMAGNETIC;}
+ public static enum X {PUMP, WIRE, WIRE4, HULL, PIPE, GLASS, PLATE, MOTOR, ROTOR, SENSOR, PISTON, CIRCUIT, EMITTER, CONVEYOR, ROBOT_ARM, COIL_HEATING, COIL_ELECTRIC, STICK_MAGNETIC, STICK_DISTILLATION, BETTER_CIRCUIT, FIELD_GENERATOR, COIL_HEATING_DOUBLE, STICK_ELECTROMAGNETIC}
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
index cffa88837e..f4dd133aa1 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Buffer.java
@@ -137,12 +137,12 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
@Override
public long getMinimumStoredEU() {
- return 512;
+ return 512L;
}
@Override
public long maxEUStore() {
- return 512 + V[mTier] * 50;
+ return 512L + V[mTier] * 50L;
}
@Override
@@ -152,7 +152,7 @@ public abstract class GT_MetaTileEntity_Buffer extends GT_MetaTileEntity_TieredM
@Override
public long maxEUOutput() {
- return bOutput ? V[mTier] : 0;
+ return bOutput ? V[mTier] : 0L;
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
index 2eda016f37..545dd34f57 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Dynamo.java
@@ -70,7 +70,7 @@ public class GT_MetaTileEntity_Hatch_Dynamo extends GT_MetaTileEntity_Hatch {
@Override
public long maxEUStore() {
- return 512 + V[mTier + 1] * 2;
+ return 512L + V[mTier + 1] * 2L;
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java
index 91bf149ea1..66ea9f8a07 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Energy.java
@@ -70,7 +70,7 @@ public class GT_MetaTileEntity_Hatch_Energy extends GT_MetaTileEntity_Hatch {
@Override
public long maxEUStore() {
- return 512 + V[mTier] * 8;
+ return 512L + V[mTier] * 8L;
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
index 4484347bd4..7f5b489548 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Input.java
@@ -15,7 +15,7 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
public GT_Recipe_Map mRecipeMap = null;
public GT_MetaTileEntity_Hatch_Input(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Fluid Input for Multiblocks (" + 8000 * (aTier + 1) + "L)");
+ super(aID, aName, aNameRegional, aTier, 3, "Fluid Input for Multiblocks (" + (8000+8000*(aTier*(aTier+1)>>1)) + "L)");
}
public GT_MetaTileEntity_Hatch_Input(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -61,7 +61,8 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
@Override
public boolean doesFillContainers() {
- return true;
+ //return true;
+ return false;
}
@Override
@@ -111,7 +112,7 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
@Override
public int getCapacity() {
- return 8000 * (mTier + 1);
+ return 8000+8000*(mTier*(mTier+1)>>1);
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java
index d4d8f9cec7..dce573f807 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Maintenance.java
@@ -48,17 +48,19 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
@Override
public String[] getDescription() {
- if(mAuto)return new String[]{mDescription,"4 Ducttape, 2 Lubricant Cells","4 Steel Screws, 2 Adv Circuits","For each autorepair"};
+ if(mAuto)return new String[]{mDescription, "4 Duct tape, 2 Lubricant Cells","4 Steel Screws, 2 Adv. Circuits","For each auto-repair"};
return new String[]{mDescription, "Cannot be shared between Multiblocks!"};
}
@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
+ if(mAuto)return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE_IDLE)};
return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE)};
}
@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
+ if(mAuto)return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_AUTOMAINTENANCE)};
return new ITexture[]{aBaseTexture, new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_MAINTENANCE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_DUCTTAPE)};
}
@@ -111,56 +113,66 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
if(mAuto) return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
return new GT_GUIContainer_MaintenanceHatch(aPlayerInventory, aBaseMetaTileEntity);
}
-
- public boolean autoMaintainance() {
- boolean tSuccess = true;
- ItemStack[] mInputs = new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}),GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2),GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4),GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)};
- List<ItemStack> aInputs = Arrays.asList(mInventory);
- if (mInputs.length > 0 && aInputs == null) tSuccess = false;
- int amt = 0;
- for (ItemStack tStack : mInputs) {
- if (tStack != null) {
- amt = tStack.stackSize;
- boolean temp = true;
- for (ItemStack aStack : aInputs) {
- if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) {
- amt -= aStack.stackSize;
- if (amt < 1) {
- temp = false;
- break;
- }
- }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if(aBaseMetaTileEntity.isServerSide() && mAuto && aTick % 100L ==0L){
+ aBaseMetaTileEntity.setActive(!isRecipeInputEqual(false));
+ }
+ }
+
+ public boolean isRecipeInputEqual(boolean aDecreaseStacksizeBySuccess) {
+ ItemStack[] mInputs=new ItemStack[]{ItemList.Duct_Tape.get(4, new Object[]{}),
+ GT_OreDictUnificator.get(OrePrefixes.cell, Materials.Lubricant, 2),
+ GT_OreDictUnificator.get(OrePrefixes.screw, Materials.Steel, 4),
+ GT_OreDictUnificator.get(OrePrefixes.circuit, Materials.Advanced, 2)};
+
+ int amt;
+
+ for (ItemStack tStack : mInputs) {
+ if (tStack != null) {
+ amt = tStack.stackSize;
+ boolean temp = true;
+ for (ItemStack aStack : mInventory) {
+ if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) {
+ amt -= aStack.stackSize;
+ if (amt < 1) {
+ temp = false;
+ break;
}
- if (temp) tSuccess = false;
}
}
- if(tSuccess){
- for (ItemStack tStack : mInputs) {
- if (tStack != null) {
- amt = tStack.stackSize;
- for (ItemStack aStack : aInputs) {
- if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) {
- if (aStack.stackSize < amt){
- amt -= aStack.stackSize;
- aStack.stackSize = 0;
- }else{
- aStack.stackSize -= amt;
- amt = 0;
- break;
- }
+ if (temp) return false;
+ }
+ }
+
+ if (aDecreaseStacksizeBySuccess) {
+ for (ItemStack tStack : mInputs) {
+ if (tStack != null) {
+ amt = tStack.stackSize;
+ for (ItemStack aStack : mInventory) {
+ if ((GT_Utility.areUnificationsEqual(aStack, tStack, true) || GT_Utility.areUnificationsEqual(GT_OreDictUnificator.get(false, aStack), tStack, true))) {
+ if (aStack.stackSize < amt){
+ amt -= aStack.stackSize;
+ aStack.stackSize = 0;
+ }else{
+ aStack.stackSize -= amt;
+ amt = 0;
+ break;
}
}
}
}
- this.mCrowbar = true;
- this.mHardHammer = true;
- this.mScrewdriver = true;
- this.mSoftHammer = true;
- this.mSolderingTool = true;
- this.mWrench = true;
- return true;
- }
- return false;
+ }
+ this.mCrowbar = true;
+ this.mHardHammer = true;
+ this.mScrewdriver = true;
+ this.mSoftHammer = true;
+ this.mSolderingTool = true;
+ this.mWrench = true;
+ }
+ return true;
}
public void onToolClick(ItemStack aStack, EntityLivingBase aPlayer) {
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
index 7246a58c26..a99a5bae75 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java
@@ -1,18 +1,22 @@
package gregtech.api.metatileentity.implementations;
+import gregtech.GT_Mod;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
+import gregtech.api.objects.XSTR;
import gregtech.common.GT_Pollution;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.ChunkPosition;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
public GT_MetaTileEntity_Hatch_Muffler(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause acidic rains and poisoning)");
+ super(aID, aName, aNameRegional, aTier, 0, "Outputs the Pollution (Might cause ... things)");
}
public GT_MetaTileEntity_Hatch_Muffler(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -68,7 +72,7 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
}
public int calculatePollutionReduction(int aPollution){
- return (int) (aPollution *(Math.pow(0.7, mTier-1)));
+ return (int) (aPollution *(Math.pow(0.85F, mTier-1)));
}
@Override
@@ -80,4 +84,57 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return false;
}
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ super.onPostTick(aBaseMetaTileEntity, aTick);
+ if(aBaseMetaTileEntity.isClientSide() && this.getBaseMetaTileEntity().isActive())
+ pollutionParticles(this.getBaseMetaTileEntity().getWorld(),"largesmoke");
+ }
+
+ private static XSTR floatGen=new XSTR();
+
+ public void pollutionParticles(World aWorld,String name){
+ boolean chk1,chk2,chk3;
+ float ran1=floatGen.nextFloat(),ran2=0,ran3=0;
+ chk1=ran1*100<calculatePollutionReduction(100);
+ if(GT_Pollution.getPollutionAtCoords(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getZCoord())>= GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ ran2=floatGen.nextFloat();
+ ran3=floatGen.nextFloat();
+ chk2=ran2*100<calculatePollutionReduction(100);
+ chk3=ran3*100<calculatePollutionReduction(100);
+ if(!(chk1||chk2||chk3))return;
+ }else{
+ if(!chk1)return;
+ chk2=chk3=false;
+ }
+
+ IGregTechTileEntity aMuffler=this.getBaseMetaTileEntity();
+ ForgeDirection aDir=ForgeDirection.getOrientation(aMuffler.getFrontFacing());
+ float xPos=aDir.offsetX*0.76F+aMuffler.getXCoord()+0.25F;
+ float yPos=aDir.offsetY*0.76F+aMuffler.getYCoord()+0.25F;
+ float zPos=aDir.offsetZ*0.76F+aMuffler.getZCoord()+0.25F;
+
+ float ySpd=aDir.offsetY*0.1F+0.2F+0.1F*floatGen.nextFloat();
+ float xSpd;
+ float zSpd;
+
+ if(aDir.offsetY==-1){
+ float temp=floatGen.nextFloat()*2*(float)Math.PI;
+ xSpd=(float)Math.sin(temp)*0.1F;
+ zSpd=(float)Math.cos(temp)*0.1F;
+ }else{
+ xSpd=aDir.offsetX*(0.1F+0.2F*floatGen.nextFloat());
+ zSpd=aDir.offsetZ*(0.1F+0.2F*floatGen.nextFloat());
+ }
+
+ if(chk1)
+ aWorld.spawnParticle(name, xPos + ran1*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd);
+
+ if(chk2)
+ aWorld.spawnParticle(name, xPos + ran2*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd);
+
+ if(chk3)
+ aWorld.spawnParticle(name, xPos + ran3*0.5F, yPos + floatGen.nextFloat()*0.5F, zPos + floatGen.nextFloat()*0.5F, xSpd, ySpd, zSpd);
+ }
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java
index 036f5e2195..051395cf19 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java
@@ -17,7 +17,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
public byte mMode = 0;
public GT_MetaTileEntity_Hatch_Output(int aID, String aName, String aNameRegional, int aTier) {
- super(aID, aName, aNameRegional, aTier, 3, "Fluid Output for Multiblocks (" + 8000 * (aTier + 1) + "L) (Screwdriver for output type)");
+ super(aID, aName, aNameRegional, aTier, 3, "Fluid Output for Multiblocks (" + (8000+8000*(aTier*(aTier+1)>>1)) + "L) (Screwdriver for output type)");
}
public GT_MetaTileEntity_Hatch_Output(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
@@ -106,7 +106,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
@Override
public boolean doesEmptyContainers() {
- return true;
+ return false;
}
@Override
@@ -141,7 +141,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
@Override
public int getCapacity() {
- return 8000 * (mTier + 1);
+ return 8000+8000*(mTier*(mTier+1)>>1);
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
index 6ac3f840b7..6e040b8405 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_OutputBus.java
@@ -84,8 +84,6 @@ public class GT_MetaTileEntity_Hatch_OutputBus extends GT_MetaTileEntity_Hatch {
return new GT_GUIContainer_2by2(aPlayerInventory, aBaseMetaTileEntity, "Output Bus");
case 2:
return new GT_GUIContainer_3by3(aPlayerInventory, aBaseMetaTileEntity, "Output Bus");
- case 3:
- return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Output Bus");
default:
return new GT_GUIContainer_4by4(aPlayerInventory, aBaseMetaTileEntity, "Output Bus");
}
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
index b0aac0bc7e..0cd152bfdb 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java
@@ -16,11 +16,14 @@ import gregtech.api.util.GT_ModHandler;
import gregtech.api.util.GT_OreDictUnificator;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
import gregtech.api.util.GT_Utility;
+import gregtech.common.GT_Pollution;
import gregtech.common.items.GT_MetaGenerated_Tool_01;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.ChunkPosition;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
@@ -221,29 +224,29 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (mMachine) {
for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) {
if (isValidMetaTileEntity(tHatch)) {
- if (!this.disableMaintenance) {
- if(tHatch.mAuto && (!mWrench||!mScrewdriver||!mSoftHammer||!mHardHammer||!mSolderingTool||!mCrowbar))tHatch.autoMaintainance();
- if (tHatch.mWrench) mWrench = true;
- if (tHatch.mScrewdriver) mScrewdriver = true;
- if (tHatch.mSoftHammer) mSoftHammer = true;
- if (tHatch.mHardHammer) mHardHammer = true;
- if (tHatch.mSolderingTool) mSolderingTool = true;
- if (tHatch.mCrowbar) mCrowbar = true;
- } else {
+ if (disableMaintenance){
mWrench = true;
mScrewdriver = true;
mSoftHammer = true;
mHardHammer = true;
mSolderingTool = true;
mCrowbar = true;
- }
+ } else {
+ if (tHatch.mAuto && !(mWrench&&mScrewdriver&&mSoftHammer&&mHardHammer&&mSolderingTool&&mCrowbar))tHatch.isRecipeInputEqual(true);
+ if (tHatch.mWrench) mWrench = true;
+ if (tHatch.mScrewdriver) mScrewdriver = true;
+ if (tHatch.mSoftHammer) mSoftHammer = true;
+ if (tHatch.mHardHammer) mHardHammer = true;
+ if (tHatch.mSolderingTool) mSolderingTool = true;
+ if (tHatch.mCrowbar) mCrowbar = true;
- tHatch.mWrench = false;
- tHatch.mScrewdriver = false;
- tHatch.mSoftHammer = false;
- tHatch.mHardHammer = false;
- tHatch.mSolderingTool = false;
- tHatch.mCrowbar = false;
+ tHatch.mWrench = false;
+ tHatch.mScrewdriver = false;
+ tHatch.mSoftHammer = false;
+ tHatch.mHardHammer = false;
+ tHatch.mSolderingTool = false;
+ tHatch.mCrowbar = false;
+ }
}
}
if (getRepairStatus() > 0) {
@@ -300,6 +303,9 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
aBaseMetaTileEntity.setErrorDisplayID((aBaseMetaTileEntity.getErrorDisplayID() & ~127) | (mWrench ? 0 : 1) | (mScrewdriver ? 0 : 2) | (mSoftHammer ? 0 : 4) | (mHardHammer ? 0 : 8) | (mSolderingTool ? 0 : 16) | (mCrowbar ? 0 : 32) | (mMachine ? 0 : 64));
aBaseMetaTileEntity.setActive(mMaxProgresstime > 0);
+ boolean active=aBaseMetaTileEntity.isActive() && mPollution>0;
+ for(GT_MetaTileEntity_Hatch_Muffler aMuffler:mMufflerHatches)
+ aMuffler.getBaseMetaTileEntity().setActive(active);
}
}
@@ -367,6 +373,13 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public abstract int getDamageToComponent(ItemStack aStack);
/**
+ * Gets the Amount of possibly outputted Items for loading the Output Stack Array from NBT.
+ * This should be the largest Amount that can ever happen legitimately.
+ */
+ @Override
+ public int getAmountOfOutputs(){return -1;}
+
+ /**
* If it explodes when the Component has to be replaced.
*/
public abstract boolean explodesOnComponentBreak(ItemStack aStack);
@@ -477,7 +490,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
}
- ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(mInventory[1], (long) Math.min(mEUt / this.damageFactorLow, Math.pow(mEUt, this.damageFactorHigh)));
+ ((GT_MetaGenerated_Tool) mInventory[1].getItem()).doDamage(mInventory[1], (long)getDamageToComponent(mInventory[1]) * (long) Math.min(mEUt / this.damageFactorLow, Math.pow(mEUt, this.damageFactorHigh)));
if (mInventory[1].stackSize == 0) mInventory[1] = null;
}
}
@@ -486,6 +499,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public void explodeMultiblock() {
+ GT_Pollution.addPollution(new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()), 300000);
mInventory[1] = null;
for (MetaTileEntity tTileEntity : mInputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);
for (MetaTileEntity tTileEntity : mOutputBusses) tTileEntity.getBaseMetaTileEntity().doExplosion(V[8]);
@@ -517,6 +531,52 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
return rVoltage;
}
+ /**
+ * Calcualtes overclocked ness using long integers
+ * @param aEUt - recipe EUt
+ * @param aDuration - recipe Duration
+ * @param mAmperage - should be 1 ?
+ */
+ protected void calculateOverclockedNessMulti(int aEUt, int aDuration, int mAmperage, long maxInputVoltage) {
+ byte mTier=(byte)Math.max(0,GT_Utility.getTier(maxInputVoltage));
+ if(mTier==0){
+ //Long time calculation
+ long xMaxProgresstime = ((long)aDuration)<<1;
+ if(xMaxProgresstime>Integer.MAX_VALUE-1){
+ //make impossible if too long
+ mEUt=Integer.MAX_VALUE-1;
+ mMaxProgresstime=Integer.MAX_VALUE-1;
+ }else{
+ mEUt=aEUt>>2;
+ mMaxProgresstime=(int)xMaxProgresstime;
+ }
+ }else{
+ //Long EUt calculation
+ long xEUt=aEUt;
+ //Isnt too low EUt check?
+ long tempEUt = xEUt<V[1] ? V[1] : xEUt;
+
+ mMaxProgresstime = aDuration;
+
+ while (tempEUt <= V[mTier -1] * mAmperage) {
+ tempEUt<<=2;//this actually controls overclocking
+ //xEUt *= 4;//this is effect of everclocking
+ mMaxProgresstime>>=1;//this is effect of overclocking
+ xEUt = mMaxProgresstime==0 ? xEUt>>1 : xEUt<<2;//U know, if the time is less than 1 tick make the machine use less power
+ }
+ if(xEUt>Integer.MAX_VALUE-1){
+ mEUt = Integer.MAX_VALUE-1;
+ mMaxProgresstime = Integer.MAX_VALUE-1;
+ }else{
+ mEUt = (int)xEUt;
+ if(mEUt==0)
+ mEUt = 1;
+ if(mMaxProgresstime==0)
+ mMaxProgresstime = 1;//set time to 1 tick
+ }
+ }
+ }
+
public boolean drainEnergyInput(long aEU) {
if (aEU <= 0) return true;
for (GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches)
@@ -637,11 +697,11 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public ArrayList<ItemStack> getStoredOutputs() {
ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
- for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
- if (isValidMetaTileEntity(tHatch)) {
- rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
- }
- }
+ //for (GT_MetaTileEntity_Hatch_Output tHatch : mOutputHatches) {
+ // if (isValidMetaTileEntity(tHatch)) {
+ // rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(1));
+ // }
+ //}
for (GT_MetaTileEntity_Hatch_OutputBus tHatch : mOutputBusses) {
if (isValidMetaTileEntity(tHatch)) {
for (int i = tHatch.getBaseMetaTileEntity().getSizeInventory() - 1; i >= 0; i--) {
@@ -665,12 +725,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
public ArrayList<ItemStack> getStoredInputs() {
ArrayList<ItemStack> rList = new ArrayList<ItemStack>();
- for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
- tHatch.mRecipeMap = getRecipeMap();
- if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) {
- rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0));
- }
- }
+ //for (GT_MetaTileEntity_Hatch_Input tHatch : mInputHatches) {
+ // tHatch.mRecipeMap = getRecipeMap();
+ // if (isValidMetaTileEntity(tHatch) && tHatch.getBaseMetaTileEntity().getStackInSlot(0) != null) {
+ // rList.add(tHatch.getBaseMetaTileEntity().getStackInSlot(0));
+ // }
+ //}
for (GT_MetaTileEntity_Hatch_InputBus tHatch : mInputBusses) {
tHatch.mRecipeMap = getRecipeMap();
if (isValidMetaTileEntity(tHatch)) {
@@ -799,7 +859,39 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
@Override
public String[] getInfoData() {
- return new String[]{"Progress:", (mProgresstime / 20) + "secs", (mMaxProgresstime / 20) + "secs", "Efficiency:", (mEfficiency / 100.0F) + "%", "Problems:", String.valueOf((getIdealStatus() - getRepairStatus()))};
+ int mPollutionReduction=0;
+ for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction);
+ }
+ }
+
+ long storedEnergy=0;
+ long maxEnergy=0;
+ for(GT_MetaTileEntity_Hatch_Energy tHatch : mEnergyHatches) {
+ if (isValidMetaTileEntity(tHatch)) {
+ storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU();
+ maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity();
+ }
+ }
+
+ return new String[]{
+ "Progress:",
+ EnumChatFormatting.GREEN + Integer.toString(mProgresstime/20) + EnumChatFormatting.RESET +" s / "+
+ EnumChatFormatting.YELLOW + Integer.toString(mMaxProgresstime/20) + EnumChatFormatting.RESET +" s",
+ "Stored Energy:",
+ EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+
+ EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU",
+ "Probably uses: "+
+ EnumChatFormatting.RED + Integer.toString(-mEUt) + EnumChatFormatting.RESET + " EU/t",
+ "Maximum total power (to all Energy Hatches, not single ones): ",
+ EnumChatFormatting.YELLOW+Long.toString(getMaxInputVoltage())+EnumChatFormatting.RESET+ " EU/t * 2A",
+ "Problems: "+
+ EnumChatFormatting.RED+ (getIdealStatus() - getRepairStatus())+EnumChatFormatting.RESET+
+ " Efficiency: "+
+ EnumChatFormatting.YELLOW+Float.toString(mEfficiency / 100.0F)+EnumChatFormatting.RESET + " %",
+ "Pollution reduced to: "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %"
+ };
}
@Override
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java
index a37bacff14..5355892d44 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java
@@ -8,6 +8,7 @@ import static gregtech.api.enums.GT_Values.GT;
public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntity {
/**
* Value between [0 - 9] to describe the Tier of this Machine.
+ * PLZ [0-15] works - READ! GT_Values class.
*/
public final byte mTier;
@@ -23,7 +24,7 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit
public GT_MetaTileEntity_TieredMachineBlock(int aID, String aName, String aNameRegional, int aTier, int aInvSlotCount, String aDescription, ITexture... aTextures) {
super(aID, aName, aNameRegional, aInvSlotCount);
- mTier = (byte) Math.max(0, Math.min(aTier, 9));
+ mTier = (byte) Math.max(0, Math.min(aTier, 15));
mDescription = aDescription;
// must always be the last call!
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java
index 31cf58ad06..9e564221b0 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java
@@ -113,27 +113,27 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
@Override
public long maxEUStore() {
- return 512 + V[mTier + 1] * 2;
+ return 512L + V[mTier + 1] * 2L;
}
@Override
public long maxEUInput() {
- return V[getBaseMetaTileEntity().isAllowedToWork() ? mTier + 1 : mTier];
+ return V[getBaseMetaTileEntity().isActive() ? mTier + 1 : mTier];
}
@Override
public long maxEUOutput() {
- return V[getBaseMetaTileEntity().isAllowedToWork() ? mTier : mTier + 1];
+ return V[getBaseMetaTileEntity().isActive() ? mTier : mTier + 1];
}
@Override
public long maxAmperesOut() {
- return getBaseMetaTileEntity().isAllowedToWork() ? V[mTier + 1] / V[mTier] : 1;
+ return getBaseMetaTileEntity().isActive() ? (V[mTier + 1] / V[mTier] < 4 ? 4 : V[mTier + 1] / V[mTier]) : 1;
}
@Override
public long maxAmperesIn() {
- return getBaseMetaTileEntity().isAllowedToWork() ? 1 : V[mTier + 1] / V[mTier];
+ return getBaseMetaTileEntity().isActive() ? 1 : (V[mTier + 1] / V[mTier] < 4 ? 4 : V[mTier + 1] / V[mTier]);
}
@Override
@@ -151,22 +151,22 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
((IEnergySource) tTileEntity).drawEnergy(tEU);
aBaseMetaTileEntity.injectEnergyUnits((byte) 6, tEU, 1);
} else if (GregTech_API.mInputRF && tTileEntity instanceof IEnergyProvider && ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), 1, true) == 1) {
- long tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), (int) maxEUInput() * 100 / GregTech_API.mRFtoEU, false);
+ long tEU = (long) ((IEnergyProvider) tTileEntity).extractEnergy(ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)), GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false);
tEU = tEU * GregTech_API.mRFtoEU / 100;
aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
} else if (GregTech_API.mInputRF && tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) {
- long tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy((int) maxEUInput() * 100 / GregTech_API.mRFtoEU, false);
+ long tEU = (long) ((IEnergyStorage) tTileEntity).extractEnergy(GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU), false);
tEU = tEU * GregTech_API.mRFtoEU / 100;
aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);
} else if (GregTech_API.mInputRF && GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) {
int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored();
- int extractRF = (int) maxEUInput() * 100 / GregTech_API.mRFtoEU;
+ int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU);
long tEU = 0;
if (tTileEntity instanceof TileCapBank) {
ICapBankNetwork network = ((TileCapBank) tTileEntity).getNetwork();
if (network != null && network.getEnergyStoredL() > 0) {
- tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * GregTech_API.mRFtoEU / 100, maxEUInput());
- network.addEnergy((int) -(tEU * 100 / GregTech_API.mRFtoEU));
+ tEU = Math.min((Math.min(Math.min(network.getEnergyStoredL(), storedRF - extractRF), network.getMaxOutput())) * (long)GregTech_API.mRFtoEU / 100L, maxEUInput());
+ network.addEnergy(GT_Utility.safeInt(-(tEU * 100 / GregTech_API.mRFtoEU)));
}
} else {
if (storedRF > extractRF) {
@@ -174,7 +174,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
tEU = maxEUInput();
} else {
((IPowerContainer) tTileEntity).setEnergyStored(0);
- tEU = storedRF * GregTech_API.mRFtoEU / 100;
+ tEU = storedRF * (long)GregTech_API.mRFtoEU / 100L;
}
}
aBaseMetaTileEntity.injectEnergyUnits((byte) 6, Math.min(tEU, maxEUInput()), 1);