aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api')
-rw-r--r--src/main/java/gregtech/api/enums/ItemList.java1
-rw-r--r--src/main/java/gregtech/api/enums/Textures.java1
-rw-r--r--src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java30
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java8
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java2
-rw-r--r--src/main/java/gregtech/api/net/GT_Packet_Pollution.java31
-rw-r--r--src/main/java/gregtech/api/util/GT_Utility.java12
7 files changed, 55 insertions, 30 deletions
diff --git a/src/main/java/gregtech/api/enums/ItemList.java b/src/main/java/gregtech/api/enums/ItemList.java
index cb6e94f5ba..6f7a0567a1 100644
--- a/src/main/java/gregtech/api/enums/ItemList.java
+++ b/src/main/java/gregtech/api/enums/ItemList.java
@@ -1474,6 +1474,7 @@ public enum ItemList implements IItemContainer {
Block_TungstenSteelReinforced,
Block_NaquadahPlate,
Block_NeutroniumPlate,
+ Block_BedrockiumCompressed,
Honeycomb,
Charcoal_Pile,
diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java
index a813eacd57..7b229550ff 100644
--- a/src/main/java/gregtech/api/enums/Textures.java
+++ b/src/main/java/gregtech/api/enums/Textures.java
@@ -351,6 +351,7 @@ public class Textures {
BLOCK_TITANIUMPREIN,
BLOCK_NAQUADAHPREIN,
BLOCK_NEUTRONIUMPREIN,
+ BLOCK_DEEP_DARK_RAW,
BLOCK_IRREIN,
BLOCK_PLASCRETE,
BLOCK_TSREIN,
diff --git a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
index 63c88cfd0a..9e37141bc6 100644
--- a/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
+++ b/src/main/java/gregtech/api/metatileentity/BaseMetaTileEntity.java
@@ -496,15 +496,17 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
for (int i = mMetaTileEntity.dechargerSlotStartIndex(), k = mMetaTileEntity.dechargerSlotCount() + i; i < k; i++) {
if (mMetaTileEntity.mInventory[i] != null && getStoredEU() < getEUCapacity()) {
dischargeItem(mMetaTileEntity.mInventory[i]);
- if(ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])>0){
+ if(ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i])>0){
if((getStoredEU() + ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]))<getEUCapacity()){
increaseStoredEnergyUnits((long)ic2.api.info.Info.itemEnergy.getEnergyValue(mMetaTileEntity.mInventory[i]),false);
mMetaTileEntity.mInventory[i].stackSize--;
+ mInventoryChanged = true;
}
}
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0) {
mMetaTileEntity.mInventory[i] = null;
- mInventoryChanged = true;
+ mInventoryChanged = true;
+ }
}
}
}
@@ -516,9 +518,10 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
for (int i = mMetaTileEntity.rechargerSlotStartIndex(), k = mMetaTileEntity.rechargerSlotCount() + i; i < k; i++) {
if (getStoredEU() > 0 && mMetaTileEntity.mInventory[i] != null) {
chargeItem(mMetaTileEntity.mInventory[i]);
- if (mMetaTileEntity.mInventory[i].stackSize <= 0)
+ if (mMetaTileEntity.mInventory[i].stackSize <= 0) {
mMetaTileEntity.mInventory[i] = null;
- mInventoryChanged = true;
+ mInventoryChanged = true;
+ }
}
}
}
@@ -545,7 +548,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
NW.sendPacketToAllPlayersInRange(worldObj,
new GT_Packet_TileEntity(xCoord, (short) yCoord, zCoord, mID,
mCoverSides[0], mCoverSides[1], mCoverSides[2], mCoverSides[3], mCoverSides[4], mCoverSides[5],
- oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)),
+ oTextureData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0) | (mWorks ? 64 : 0) ),
oTexturePage = (hasValidMetaTileEntity() && mMetaTileEntity instanceof GT_MetaTileEntity_Hatch) ? ((GT_MetaTileEntity_Hatch) mMetaTileEntity).getTexturePage() : 0,
oUpdateData = hasValidMetaTileEntity() ? mMetaTileEntity.getUpdateData() : 0,
oRedstoneData = (byte) (((mSidedRedstone[0] > 0) ? 1 : 0) | ((mSidedRedstone[1] > 0) ? 2 : 0) | ((mSidedRedstone[2] > 0) ? 4 : 0) | ((mSidedRedstone[3] > 0) ? 8 : 0) | ((mSidedRedstone[4] > 0) ? 16 : 0) | ((mSidedRedstone[5] > 0) ? 32 : 0)),
@@ -556,7 +559,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
}
if (mTickTimer > 10) {
- byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0));
+ byte tData = (byte) ((mFacing & 7) | (mActive ? 8 : 0) | (mRedstone ? 16 : 0) | (mLockUpgrade ? 32 : 0)| (mWorks ? 64 : 0));
if (tData != oTextureData) sendBlockEvent((byte) 0, oTextureData = tData);
tData = mMetaTileEntity.getUpdateData();
@@ -681,6 +684,7 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
mActive = ((aValue & 8) != 0);
mRedstone = ((aValue & 16) != 0);
//mLockUpgrade = ((aValue&32) != 0);
+ mWorks = ((aValue & 64) != 0);
break;
case 1:
if (hasValidMetaTileEntity()) {
@@ -1724,15 +1728,19 @@ public class BaseMetaTileEntity extends BaseTileEntity implements IGregTechTileE
@Override
public long getAverageElectricInput() {
long rEU = 0;
- for (long tEU : mAverageEUInput) rEU += tEU;
- return rEU / mAverageEUInput.length;
+ for (int i = 0; i < mAverageEUInput.length; ++i)
+ if (i != mAverageEUInputIndex)
+ rEU += mAverageEUInput[i];
+ return rEU / (mAverageEUInput.length - 1);
}
@Override
public long getAverageElectricOutput() {
long rEU = 0;
- for (long tEU : mAverageEUOutput) rEU += tEU;
- return rEU / mAverageEUOutput.length;
+ for (int i = 0; i < mAverageEUOutput.length; ++i)
+ if (i != mAverageEUOutputIndex)
+ rEU += mAverageEUOutput[i];
+ return rEU / (mAverageEUOutput.length - 1);
}
@Override
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 0767bd0081..23afaa84f7 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
@@ -104,7 +104,13 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
{1, 0, 2, 3},
{1, 0, 2, 3}
};
- if (aSide >= 0 && aSide < 6) for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i;
+ if (aSide >= 0 && aSide < 6) {
+ for (byte i = 0; i < 4; i++) if (isInputDisabledAtSide(sRestrictionArray[aSide][i])) tMask |= 1 << i;
+ //Full block size renderer flips side 5 and 2 textures, flip restrictor textures to compensate
+ if (tThickNess >= 0.99F && (aSide == 5 || aSide == 2))
+ if (tMask > 3 && tMask < 12)
+ tMask = (byte) (tMask ^ 12);
+ }
return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)};
}
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 f33b8aa3d9..711670db08 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
@@ -60,7 +60,7 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aActive ? 0 : 6)][aColorIndex + 1];
+ return mTextures[Math.min(2, aSide) + (aSide == aFacing ? 3 : 0) + (aBaseMetaTileEntity.isAllowedToWork() ? 0 : 6)][aColorIndex + 1];
}
@Override
diff --git a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
index 2c67d74150..7f717c1a47 100644
--- a/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
+++ b/src/main/java/gregtech/api/net/GT_Packet_Pollution.java
@@ -1,38 +1,47 @@
package gregtech.api.net;
import com.google.common.io.ByteArrayDataInput;
-import com.google.common.io.ByteArrayDataOutput;
-import com.google.common.io.ByteStreams;
-import gregtech.common.GT_Pollution;
+import gregtech.common.GT_Client;
+import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.IBlockAccess;
+import java.nio.ByteBuffer;
+
public class GT_Packet_Pollution extends GT_Packet {
- private int mPollution;
+ private ChunkCoordIntPair chunk;
+ private int pollution;
public GT_Packet_Pollution() {
super(true);
}
- public GT_Packet_Pollution(int aPollution) {
+ public GT_Packet_Pollution(ChunkCoordIntPair chunk, int pollution) {
super(false);
- mPollution = aPollution;
+ this.chunk = chunk;
+ this.pollution = pollution;
}
@Override
public byte[] encode() {
- ByteArrayDataOutput tOut = ByteStreams.newDataOutput(4);
- tOut.writeInt(mPollution);
- return tOut.toByteArray();
+ return ByteBuffer
+ .allocate(12)
+ .putInt(chunk.chunkXPos)
+ .putInt(chunk.chunkZPos)
+ .putInt(pollution)
+ .array();
}
@Override
public GT_Packet decode(ByteArrayDataInput aData) {
- return new GT_Packet_Pollution(aData.readInt());
+ return new GT_Packet_Pollution(
+ new ChunkCoordIntPair(aData.readInt(), aData.readInt()),
+ aData.readInt()
+ );
}
@Override
public void process(IBlockAccess aWorld) {
- GT_Pollution.mPlayerPollution = mPollution;
+ GT_Client.recieveChunkPollutionPacket(chunk, pollution);
}
@Override
diff --git a/src/main/java/gregtech/api/util/GT_Utility.java b/src/main/java/gregtech/api/util/GT_Utility.java
index f5dfb42a2c..6df77f16bf 100644
--- a/src/main/java/gregtech/api/util/GT_Utility.java
+++ b/src/main/java/gregtech/api/util/GT_Utility.java
@@ -559,14 +559,14 @@ public class GT_Utility {
for (int i = 0; i < tGrabSlots.length; i++) {
byte tMovedItemCount = 0;
- for (int j = 0; j < tPutSlots.length; j++) {
- if (listContainsItem(aFilter, aTileEntity1.getStackInSlot(tGrabSlots[i]), true, aInvertFilter)) {
- if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, aTileEntity1.getStackInSlot(tGrabSlots[i]))) {
- if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, aTileEntity1.getStackInSlot(tGrabSlots[i]), aMaxTargetStackSize)) {
- tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce);
+ ItemStack tGrabStack = aTileEntity1.getStackInSlot(tGrabSlots[i]);
+ if (listContainsItem(aFilter, tGrabStack, true, aInvertFilter)) {
+ if (isAllowedToTakeFromSlot(aTileEntity1, tGrabSlots[i], aGrabFrom, tGrabStack)) {
+ for (int j = 0; j < tPutSlots.length; j++) {
+ if (isAllowedToPutIntoSlot((IInventory) aTileEntity2, tPutSlots[j], aPutTo, tGrabStack, aMaxTargetStackSize)) {
+ tMovedItemCount += moveStackFromSlotAToSlotB(aTileEntity1, (IInventory) aTileEntity2, tGrabSlots[i], tPutSlots[j], aMaxTargetStackSize, aMinTargetStackSize, (byte) (aMaxMoveAtOnce - tMovedItemCount), aMinMoveAtOnce);
if (tMovedItemCount >= aMaxMoveAtOnce) {
return tMovedItemCount;
-
}
}
}