aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/metatileentity/implementations
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/api/metatileentity/implementations')
-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.java17
-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.java28
-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.java44
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler.java65
-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.java167
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_TieredMachineBlock.java7
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java22
18 files changed, 445 insertions, 161 deletions
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 5c24805503..c35690b868 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;
@@ -54,7 +55,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;
}
@@ -116,12 +117,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
@@ -136,7 +137,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
@Override
public long maxAmperesIn() {
- return mChargeableCount * 2;
+ return mChargeableCount * 2L;
}
@Override
@@ -316,14 +317,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 76b2e9aaf5..509c6f0ec5 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;
@@ -144,17 +145,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
@@ -188,6 +190,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) {
if (mFluid == null) {
@@ -202,6 +210,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
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, (maxEUOutput() * 20 + getMinimumStoredEU() - aBaseMetaTileEntity.getUniversalEnergyStored()) / tFuelValue);//TODO CHECK
if (tFluidAmountToUse > 0 && aBaseMetaTileEntity.increaseStoredEnergyUnits(tFluidAmountToUse * tFuelValue, true)) {
GT_Pollution.addPollution(this.getBaseMetaTileEntity().getWorld(), new ChunkPosition(this.getBaseMetaTileEntity().getXCoord(), this.getBaseMetaTileEntity().getYCoord(), this.getBaseMetaTileEntity().getZCoord()),
10 * getPollution());
@@ -226,7 +235,7 @@ public abstract class GT_MetaTileEntity_BasicGenerator extends GT_MetaTileEntity
if (aBaseMetaTileEntity.isServerSide())
aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity.getUniversalEnergyStored() >= maxEUOutput() + getMinimumStoredEU());
}
-
+
public abstract int getPollution();
public abstract GT_Recipe_Map getRecipes();
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 fc4ecfeea9..56df2b1a96 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;
@@ -208,12 +209,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
@@ -228,7 +229,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
@@ -435,8 +436,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();
@@ -476,7 +477,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;
@@ -539,16 +540,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
}
}
}
@@ -684,12 +715,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
@@ -741,6 +777,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());
@@ -763,7 +808,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;
}
@@ -822,4 +872,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 06a115d3d4..d87e6d5ab8 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
@@ -35,7 +35,6 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
private final String mSound;
private final boolean mSharedTank, mRequiresFluidForFiltering;
private final byte mGUIParameterA, mGUIParameterB;
-
public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aGUIParameterA, int aGUIParameterB, String aGUIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect, String aOverlays, Object[] aRecipe) {
super(aID, aName, aNameRegional, aTier, aRecipes.mAmperage, aDescription, aInputSlots, aOutputSlots, aGUIName, aRecipes.mNEIName, new ITexture[]{new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_SIDE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_FRONT")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_TOP")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM_ACTIVE")), new GT_RenderedTexture(new Textures.BlockIcons.CustomIcon("basicmachines/" + aOverlays.toLowerCase(Locale.ENGLISH) + "/OVERLAY_BOTTOM"))});
mSharedTank = aSharedTank;
@@ -47,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) {
@@ -75,8 +76,15 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 6:
case 7:
case 8:
- aRecipe[i] = Ic2Items.reinforcedGlass;
- break;
+ case 9:
+ case 10:
+ case 11:
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ aRecipe[i] = Ic2Items.reinforcedGlass;
+ break;
default:
aRecipe[i] = new ItemStack(Blocks.glass, 1, W);
break;
@@ -112,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;
@@ -146,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;
@@ -180,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;
@@ -214,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;
@@ -245,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;
@@ -704,5 +712,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 abbf5b7ee5..42758c86e1 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
@@ -141,12 +141,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
@@ -156,7 +156,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 e599aa0902..df28cd7e54 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
@@ -74,7 +74,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 8d9f23f64e..bd362de26b 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
@@ -74,7 +74,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 4c24a148ab..5a50e4f19d 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) {
@@ -65,7 +65,8 @@ public class GT_MetaTileEntity_Hatch_Input extends GT_MetaTileEntity_Hatch {
@Override
public boolean doesFillContainers() {
- return true;
+ //return true;
+ return false;
}
@Override
@@ -115,7 +116,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 3bcd29a6c9..b8f01f29d6 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
@@ -34,7 +34,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
super(aID, aName, aNameRegional, aTier, 1, "For maintaining Multiblocks");
mAuto = false;
}
-
+
public GT_MetaTileEntity_Hatch_Maintenance(int aID, String aName, String aNameRegional, int aTier, boolean aAuto) {
super(aID, aName, aNameRegional, aTier, 4, "For automatically maintaining Multiblocks");
mAuto = aAuto;
@@ -69,11 +69,13 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
@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)};
}
@@ -104,7 +106,7 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
@Override
public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- if (aTileEntity.getMetaTileID() == 111)
+ if (aTileEntity.getMetaTileID() == 111)//TODO CHECK
return new GT_MetaTileEntity_Hatch_Maintenance(mName, mTier, mDescriptionArray, mTextures, true);
return new GT_MetaTileEntity_Hatch_Maintenance(mName, mTier, mDescriptionArray, mTextures, false);
}
@@ -128,17 +130,27 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
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;
+ @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 : aInputs) {
+ 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) {
@@ -147,19 +159,20 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
}
}
}
- if (temp) tSuccess = false;
+ if (temp) return false;
}
}
- if (tSuccess) {
+
+ if (aDecreaseStacksizeBySuccess) {
for (ItemStack tStack : mInputs) {
if (tStack != null) {
amt = tStack.stackSize;
- for (ItemStack aStack : aInputs) {
+ 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) {
+ if (aStack.stackSize < amt){
amt -= aStack.stackSize;
aStack.stackSize = 0;
- } else {
+ }else{
aStack.stackSize -= amt;
amt = 0;
break;
@@ -174,9 +187,8 @@ public class GT_MetaTileEntity_Hatch_Maintenance extends GT_MetaTileEntity_Hatch
this.mSoftHammer = true;
this.mSolderingTool = true;
this.mWrench = true;
- return true;
}
- return false;
+ 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 dde8d7cf4f..617d17aadb 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) {
@@ -74,9 +78,9 @@ public class GT_MetaTileEntity_Hatch_Muffler extends GT_MetaTileEntity_Hatch {
}
return false;
}
-
- public int calculatePollutionReduction(int aPollution) {
- return (int) (aPollution * (Math.pow(0.7, mTier - 1)));
+
+ public int calculatePollutionReduction(int aPollution){
+ return (int) (aPollution *(Math.pow(0.85F, mTier - 1)));
}
@Override
@@ -88,4 +92,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(aWorld,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 8221290459..20083249d7 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) {
@@ -110,7 +110,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
@Override
public boolean doesEmptyContainers() {
- return true;
+ return false;
}
@Override
@@ -145,7 +145,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 9b685743ca..f39694cc2d 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
@@ -88,8 +88,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 3dd59126b8..5d240f0c5f 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;
@@ -117,8 +120,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
aNBT.setInteger("mRuntime", mRuntime);
if (mOutputItems != null) {
- aNBT.setInteger("mOutputItemsLength", mOutputItems.length);
- for (int i = 0; i < mOutputItems.length; i++)
+ aNBT.setInteger("mOutputItemsLength", mOutputItems.length);
+ for (int i = 0; i < mOutputItems.length; i++)
if (mOutputItems[i] != null) {
NBTTagCompound tNBT = new NBTTagCompound();
mOutputItems[i].writeToNBT(tNBT);
@@ -126,8 +129,8 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
}
if (mOutputFluids != null) {
- aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length);
- for (int i = 0; i < mOutputFluids.length; i++)
+ aNBT.setInteger("mOutputFluidsLength", mOutputFluids.length);
+ for (int i = 0; i < mOutputFluids.length; i++)
if (mOutputFluids[i] != null) {
NBTTagCompound tNBT = new NBTTagCompound();
mOutputFluids[i].writeToNBT(tNBT);
@@ -152,12 +155,12 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
mEfficiency = aNBT.getInteger("mEfficiency");
mPollution = aNBT.getInteger("mPollution");
mRuntime = aNBT.getInteger("mRuntime");
-
+
int aOutputItemsLength = aNBT.getInteger("mOutputItemsLength");
if (aOutputItemsLength > 0) {
mOutputItems = new ItemStack[aOutputItemsLength];
for (int i = 0; i < mOutputItems.length; i++)
- mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
+ mOutputItems[i] = GT_Utility.loadItem(aNBT, "mOutputItem" + i);
}
int aOutputFluidsLength = aNBT.getInteger("mOutputFluidsLength");
@@ -166,7 +169,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
for (int i = 0; i < mOutputFluids.length; i++)
mOutputFluids[i] = GT_Utility.loadFluid(aNBT, "mOutputFluids" + i);
}
-
+
mWrench = aNBT.getBoolean("mWrench");
mScrewdriver = aNBT.getBoolean("mScrewdriver");
mSoftHammer = aNBT.getBoolean("mSoftHammer");
@@ -221,30 +224,29 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
if (mMachine) {
for (GT_MetaTileEntity_Hatch_Maintenance tHatch : mMaintenanceHatches) {
if (isValidMetaTileEntity(tHatch)) {
- if (!GT_MetaTileEntity_MultiBlockBase.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) {
@@ -304,6 +306,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);
}
}
@@ -371,6 +376,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.
+ */
+ @Deprecated
+ public int getAmountOfOutputs(){return -1;}
+
+ /**
* If it explodes when the Component has to be replaced.
*/
public abstract boolean explodesOnComponentBreak(ItemStack aStack);
@@ -481,7 +493,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;
}
}
@@ -490,6 +502,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
}
public void explodeMultiblock() {
+ GT_Pollution.addPollution(getBaseMetaTileEntity().getWorld(),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]);
@@ -521,6 +534,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)
@@ -641,11 +700,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--) {
@@ -669,12 +728,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)) {
@@ -728,7 +787,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity();
if (aMetaTileEntity == null) return false;
if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) {
- ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
+ ((GT_MetaTileEntity_Hatch) aMetaTileEntity).mMachineBlock = (byte) aBaseCasingIndex;
return mMaintenanceHatches.add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity);
}
return false;
@@ -803,7 +862,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 4187307c6b..c413fe3c07 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;
@@ -26,7 +27,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));
mDescriptionArray = aDescription == null ? new String[0] : new String[]{aDescription};
mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : "";
// must always be the last call!
@@ -36,7 +37,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));
mDescriptionArray = aDescription == null ? new String[0] : aDescription;
mDescription = mDescriptionArray.length > 0 ? mDescriptionArray[0] : "";
@@ -88,4 +89,4 @@ public abstract class GT_MetaTileEntity_TieredMachineBlock extends MetaTileEntit
* @param aTextures is the optional Array you can give to the Constructor.
*/
public abstract ITexture[][][] getTextureSet(ITexture[] aTextures);
-} \ No newline at end of file
+}
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 9320c6d8b4..3e6a28c22e 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
@@ -117,27 +117,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
@@ -155,22 +155,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) {
@@ -178,7 +178,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);