aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity
diff options
context:
space:
mode:
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity')
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java313
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java6
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java532
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java2
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java491
7 files changed, 1142 insertions, 209 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
new file mode 100644
index 0000000000..1ce7fc49d3
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java
@@ -0,0 +1,313 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power;
+
+import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.GT_Utility;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
+import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import java.util.Collection;
+import java.util.Iterator;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.init.Blocks;
+import net.minecraft.item.ItemStack;
+import net.minecraftforge.fluids.FluidStack;
+
+public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank {
+ public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription,
+ ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures);
+ }
+
+ public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier,
+ String[] aDescription, ITexture... aTextures) {
+ super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures);
+ }
+
+ public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 3, aDescription, aTextures);
+ }
+
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ ITexture[][][] rTextures = new ITexture[10][17][];
+
+ for (byte i = -1; i < 16; ++i) {
+ rTextures[0][i + 1] = this.getFront(i);
+ rTextures[1][i + 1] = this.getBack(i);
+ rTextures[2][i + 1] = this.getBottom(i);
+ rTextures[3][i + 1] = this.getTop(i);
+ rTextures[4][i + 1] = this.getSides(i);
+ rTextures[5][i + 1] = this.getFrontActive(i);
+ rTextures[6][i + 1] = this.getBackActive(i);
+ rTextures[7][i + 1] = this.getBottomActive(i);
+ rTextures[8][i + 1] = this.getTopActive(i);
+ rTextures[9][i + 1] = this.getSidesActive(i);
+ }
+
+ return rTextures;
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex,
+ boolean aActive, boolean aRedstone) {
+ return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing
+ ? 0
+ : (aSide == GT_Utility.getOppositeSide(aFacing)
+ ? 1
+ : (aSide == 0 ? 2 : (aSide == 1 ? 3 : 4))))][aColorIndex + 1];
+ }
+
+ public String[] getDescription() {
+ String[] desc = new String[this.mDescriptionArray.length + 1];
+ System.arraycopy(this.mDescriptionArray, 0, desc, 0, this.mDescriptionArray.length);
+ desc[this.mDescriptionArray.length] = "Fuel Efficiency: " + this.getEfficiency() + "%";
+ return desc;
+ }
+
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ Logger.WARNING("Right Clicked");
+ if (aBaseMetaTileEntity.isClientSide()) {
+ return true;
+ } else {
+ aBaseMetaTileEntity.openGUI(aPlayer);
+ return true;
+ }
+ }
+
+ public ITexture[] getFront(byte aColor) {
+ return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]};
+ }
+
+ public ITexture[] getBack(byte aColor) {
+ return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]};
+ }
+
+ public ITexture[] getBottom(byte aColor) {
+ return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]};
+ }
+
+ public ITexture[] getTop(byte aColor) {
+ return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]};
+ }
+
+ public ITexture[] getSides(byte aColor) {
+ return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]};
+ }
+
+ public ITexture[] getFrontActive(byte aColor) {
+ return this.getFront(aColor);
+ }
+
+ public ITexture[] getBackActive(byte aColor) {
+ return this.getBack(aColor);
+ }
+
+ public ITexture[] getBottomActive(byte aColor) {
+ return this.getBottom(aColor);
+ }
+
+ public ITexture[] getTopActive(byte aColor) {
+ return this.getTop(aColor);
+ }
+
+ public ITexture[] getSidesActive(byte aColor) {
+ return this.getSides(aColor);
+ }
+
+ public boolean isFacingValid(byte aSide) {
+ return aSide > 1;
+ }
+
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ public boolean isValidSlot(int aIndex) {
+ return aIndex < 2;
+ }
+
+ public boolean isEnetOutput() {
+ return true;
+ }
+
+ public boolean isOutputFacing(byte aSide) {
+ return true;
+ }
+
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ public long maxEUOutput() {
+ return this.getBaseMetaTileEntity().isAllowedToWork() ? GT_Values.V[this.mTier] : 0L;
+ }
+
+ public long maxEUStore() {
+ return Math.max(this.getEUVar(), GT_Values.V[this.mTier] * 40L + this.getMinimumStoredEU());
+ }
+
+ public boolean doesFillContainers() {
+ return this.getBaseMetaTileEntity().isAllowedToWork();
+ }
+
+ public boolean doesEmptyContainers() {
+ return this.getBaseMetaTileEntity().isAllowedToWork();
+ }
+
+ public boolean canTankBeFilled() {
+ return this.getBaseMetaTileEntity().isAllowedToWork();
+ }
+
+ public boolean canTankBeEmptied() {
+ return this.getBaseMetaTileEntity().isAllowedToWork();
+ }
+
+ public boolean displaysItemStack() {
+ return true;
+ }
+
+ public boolean displaysStackSize() {
+ return false;
+ }
+
+ public boolean isFluidInputAllowed(FluidStack aFluid) {
+ int aVal = this.getFuelValue(aFluid);
+ Logger.WARNING("Fuel Value: "+aVal);
+ return aVal > 0;
+ }
+
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) {
+ int tFuelValue;
+ if (this.mFluid == null) {
+ if (aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() + this.getMinimumStoredEU()) {
+ this.mInventory[this.getStackDisplaySlot()] = null;
+ } else {
+ if (this.mInventory[this.getStackDisplaySlot()] == null) {
+ this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1);
+ }
+
+ this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: "
+ + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU");
+ }
+ } else {
+ tFuelValue = this.getFuelValue(this.mFluid);
+ int tConsumed = this.consumedFluidPerOperation(this.mFluid);
+ if (tFuelValue > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) {
+ long tFluidAmountToUse = Math.min((long) (this.mFluid.amount / tConsumed),
+ (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue);
+ if (tFluidAmountToUse > 0L && aBaseMetaTileEntity
+ .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) {
+ PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution());
+ this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed);
+ }
+ }
+ }
+
+ if (this.mInventory[this.getInputSlot()] != null
+ && aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() * 20L
+ + this.getMinimumStoredEU()
+ && GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) {
+ tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]);
+ if (tFuelValue > 0) {
+ ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]);
+ if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) {
+ aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true);
+ aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1);
+ PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution());
+ }
+ }
+ }
+ }
+
+ if (aBaseMetaTileEntity.isServerSide()) {
+ Logger.WARNING("Ticking Servside");
+ aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity
+ .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU());
+ }
+
+ }
+
+ public abstract int getPollution();
+
+ public abstract GT_Recipe_Map getRecipes();
+
+ public abstract int getEfficiency();
+
+ public int consumedFluidPerOperation(FluidStack aLiquid) {
+ return 1;
+ }
+
+ public int getFuelValue(FluidStack aLiquid) {
+ if (aLiquid != null && this.getRecipes() != null) {
+ Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList;
+ Logger.WARNING("Fuels: "+tRecipeList.size());
+ if (tRecipeList != null) {
+ Iterator var4 = tRecipeList.iterator();
+
+ while (var4.hasNext()) {
+ GT_Recipe tFuel = (GT_Recipe) var4.next();
+ FluidStack tLiquid;
+ if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null
+ && aLiquid.isFluidEqual(tLiquid)) {
+ Logger.WARNING("Fuel Ok");
+ return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency()
+ * (long) this.consumedFluidPerOperation(tLiquid) / 100L);
+ }
+ if ((tLiquid = tFuel.getRepresentativeFluidInput(0)) != null
+ && aLiquid.isFluidEqual(tLiquid)) {
+ Logger.WARNING("Fuel Ok");
+ return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency()
+ * (long) this.consumedFluidPerOperation(tLiquid) / 100L);
+ }
+ }
+ }
+
+ return 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public int getFuelValue(ItemStack aStack) {
+ if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) {
+ Logger.WARNING("Fuel Item OK");
+ GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
+ (FluidStack[]) null, new ItemStack[]{aStack});
+ return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0;
+ } else {
+ return 0;
+ }
+ }
+
+ public ItemStack getEmptyContainer(ItemStack aStack) {
+ if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) {
+ GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE,
+ (FluidStack[]) null, new ItemStack[]{aStack});
+ return tFuel != null
+ ? GT_Utility.copy(new Object[]{tFuel.getOutput(0)})
+ : GT_Utility.getContainerItem(aStack, true);
+ } else {
+ return null;
+ }
+ }
+
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (this.getFuelValue(aStack) > 0
+ || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0);
+ }
+
+ public int getCapacity() {
+ return 16000;
+ }
+
+ public int getTankPressure() {
+ return -100;
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
index 03c8fadad4..9c6840e33c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java
@@ -6,6 +6,8 @@ import gregtech.api.gui.GT_GUIContainer_BasicTank;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
+import gtPlusPlus.xmod.gregtech.api.gui.power.CONTAINER_BasicTank;
+import gtPlusPlus.xmod.gregtech.api.gui.power.GUI_BasicTank;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -115,12 +117,12 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock {
@Override
public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
+ return new CONTAINER_BasicTank(aPlayerInventory, aBaseMetaTileEntity);
}
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
+ return new GUI_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName());
}
@Override
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java
new file mode 100644
index 0000000000..68ec0ba0c9
--- /dev/null
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java
@@ -0,0 +1,532 @@
+package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import gregtech.GT_Mod;
+import gregtech.api.enums.Dyes;
+import gregtech.api.enums.Materials;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.enums.Textures.BlockIcons;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
+import gregtech.api.interfaces.tileentity.IEnergyConnected;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+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 gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.xmod.gregtech.api.interfaces.IHeatEntity;
+import gtPlusPlus.xmod.gregtech.api.interfaces.IMetaTileEntityHeatPipe;
+import gtPlusPlus.xmod.gregtech.common.StaticFields59;
+import ic2.api.energy.tile.IEnergySink;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.EntityLivingBase;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.AxisAlignedBB;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.world.World;
+import net.minecraftforge.common.util.ForgeDirection;
+
+public class GT_MetaPipeEntity_Heat extends MetaPipeEntity implements IMetaTileEntityHeatPipe, IHeatEntity {
+
+ public final Materials mMaterial;
+ public final long mHeatLossPerMeter, mAmperage, mMaxTemp;
+ public final boolean mInsulated, mCanShock;
+ public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0;
+ public short mOverheat;
+
+ private boolean mCheckConnections;
+ public byte mDisableInput;
+
+ public GT_MetaPipeEntity_Heat(int aID, String aName, String aNameRegional, Materials aMaterial, long aMaxTemp) {
+ super(aID, aName, aNameRegional, 0);
+ mMaterial = aMaterial;
+ mAmperage = 1;
+ mMaxTemp = aMaxTemp;
+ mInsulated = false;
+ mCanShock = true;
+ mHeatLossPerMeter = aMaxTemp/1000;
+ }
+
+ public GT_MetaPipeEntity_Heat(String aName, Materials aMaterial, long aMaxTemp) {
+ super(aName, 0);
+ mMaterial = aMaterial;
+ mAmperage = 1;
+ mMaxTemp = aMaxTemp;
+ mInsulated = false;
+ mCanShock = true;
+ mHeatLossPerMeter = aMaxTemp/1000;
+ }
+
+
+ @Override
+ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new GT_MetaPipeEntity_Heat(mName, mMaterial, mMaxTemp);
+ }
+
+ @Override
+ public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) {
+ if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase)
+ GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20);
+ }
+
+ @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);
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(byte aFacing) {
+ return false;
+ }
+
+ @Override
+ public boolean isValidSlot(int aIndex) {
+ return true;
+ }
+
+ @Override
+ public final boolean renderInside(byte aSide) {
+ return false;
+ }
+
+ @Override
+ public int getProgresstime() {
+ return (int) mTransferredAmperage * 64;
+ }
+
+ @Override
+ public int maxProgresstime() {
+ return (int) mAmperage * 64;
+ }
+
+ @Override
+ public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
+ if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity()))
+ return 0;
+ return transferHeat(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity) getBaseMetaTileEntity())));
+ }
+
+ @Override
+ public long transferHeat(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) {
+ if (!this.isConnectedAtSide(aSide) && aSide != 6) {
+ return 0L;
+ } else {
+ long rUsedAmperes = 0L;
+ aVoltage -= this.mHeatLossPerMeter;
+ if (aVoltage > 0L) {
+ for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; ++i) {
+ if (i != aSide && this.isConnectedAtSide(i)
+ && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i,
+ this.getBaseMetaTileEntity().getCoverIDAtSide(i),
+ this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) {
+ TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i);
+ if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) {
+ aAlreadyPassedTileEntityList.add(tTileEntity);
+ if (tTileEntity instanceof IEnergyConnected) {
+ if (this.getBaseMetaTileEntity().getColorization() >= 0) {
+ byte tColor = ((IEnergyConnected) tTileEntity).getColorization();
+ if (tColor >= 0 && tColor != this.getBaseMetaTileEntity().getColorization()) {
+ continue;
+ }
+ }
+
+ if (tTileEntity instanceof IGregTechTileEntity
+ && ((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity() instanceof IMetaTileEntityHeatPipe
+ && ((IGregTechTileEntity) tTileEntity)
+ .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i))
+ .letsEnergyIn(GT_Utility.getOppositeSide(i),
+ ((IGregTechTileEntity) tTileEntity)
+ .getCoverIDAtSide(GT_Utility.getOppositeSide(i)),
+ ((IGregTechTileEntity) tTileEntity)
+ .getCoverDataAtSide(GT_Utility.getOppositeSide(i)),
+ (IGregTechTileEntity) tTileEntity)) {
+ if (((IGregTechTileEntity) tTileEntity).getTimer() > 50L) {
+ rUsedAmperes += ((IMetaTileEntityHeatPipe) ((IGregTechTileEntity) tTileEntity)
+ .getMetaTileEntity()).transferHeat(GT_Utility.getOppositeSide(i),
+ aVoltage, aAmperage - rUsedAmperes,
+ aAlreadyPassedTileEntityList);
+ }
+ } else {
+ rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits(
+ GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes);
+ }
+ } else {
+ ForgeDirection tDirection;
+
+ if (tTileEntity instanceof IEnergySink) {
+ tDirection = ForgeDirection.getOrientation(i).getOpposite();
+ if (((IEnergySink) tTileEntity)
+ .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection)
+ && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0.0D
+ && ((IEnergySink) tTileEntity).injectEnergy(tDirection, (double) aVoltage,
+ (double) aVoltage) < (double) aVoltage) {
+ ++rUsedAmperes;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ this.mTransferredAmperage += rUsedAmperes;
+ this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage);
+ this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage);
+ if (aVoltage <= this.mMaxTemp && this.mTransferredAmperage <= this.mAmperage) {
+ return rUsedAmperes;
+ } else {
+ if (this.mOverheat > GT_Mod.gregtechproxy.mWireHeatingTicks * 100) {
+ //this.getBaseMetaTileEntity().setToFire();
+ } else {
+ this.mOverheat = (short) (this.mOverheat + 100);
+ }
+
+ return aAmperage;
+ }
+ }
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ this.mTransferredAmperage = 0L;
+ if (this.mOverheat > 0) {
+ --this.mOverheat;
+ }
+
+ if (aTick % 20L == 0L) {
+ this.mTransferredVoltageLast20 = 0L;
+ this.mTransferredAmperageLast20 = 0L;
+
+ for (byte tSide = 0; tSide < 6; ++tSide) {
+ IGregTechTileEntity tBaseMetaTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(tSide);
+ byte uSide = GT_Utility.getOppositeSide(tSide);
+ if ((this.mCheckConnections || this.isConnectedAtSide(tSide)
+ || aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide,
+ aBaseMetaTileEntity.getCoverIDAtSide(tSide),
+ aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity)
+ || tBaseMetaTileEntity != null && tBaseMetaTileEntity.getCoverBehaviorAtSide(uSide)
+ .alwaysLookConnected(uSide, tBaseMetaTileEntity.getCoverIDAtSide(uSide),
+ tBaseMetaTileEntity.getCoverDataAtSide(uSide), tBaseMetaTileEntity))
+ && this.connect(tSide) == 0) {
+ this.disconnect(tSide);
+ }
+ }
+
+ if (isGT6Pipes()) {
+ this.mCheckConnections = false;
+ }
+ }
+ } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) {
+ aBaseMetaTileEntity.issueTextureUpdate();
+ }
+
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
+ return false;
+ }
+
+ @Override
+ public String[] getDescription() {
+ return new String[]{
+ "Max Voltage: " + EnumChatFormatting.GOLD + mMaxTemp + "C" + EnumChatFormatting.GRAY,
+ "Loss: " + EnumChatFormatting.RED + mHeatLossPerMeter + EnumChatFormatting.GRAY + " HU per meter",
+ CORE.GT_Tooltip
+ };
+ }
+
+ @Override
+ public float getThickNess() {
+ return 1;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("HeatBuffer", this.HeatBuffer);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ this.HeatBuffer = aNBT.getInteger("HeatBuffer");
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+ protected int transmitHeat;
+ protected int maxHeatEmitpeerTick;
+ protected int HeatBuffer;
+
+
+
+
+ public byte getTileEntityBaseType() {
+ return 4;
+ }
+
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections,
+ byte aColorIndex, boolean aConnected, boolean aRedstone) {
+ float tThickNess = this.getThickNess();
+ if (this.mDisableInput == 0) {
+ return new ITexture[]{(ITexture) (aConnected
+ ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex)
+ : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa)))};
+ } else {
+ byte tMask = 0;
+ byte[][] sRestrictionArray = new byte[][]{{2, 3, 5, 4}, {2, 3, 4, 5}, {1, 0, 4, 5}, {1, 0, 4, 5},
+ {1, 0, 2, 3}, {1, 0, 2, 3}};
+ if (aSide >= 0 && aSide < 6) {
+ for (byte i = 0; i < 4; ++i) {
+ if (this.isInputDisabledAtSide(sRestrictionArray[aSide][i])) {
+ tMask = (byte) (tMask | 1 << i);
+ }
+ }
+ }
+
+ return new ITexture[]{
+ (ITexture) (aConnected
+ ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex)
+ : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa))),
+ getRestrictorTexture(tMask)};
+ }
+ }
+
+ protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial,
+ byte aColorIndex) {
+ if (aPipeAmount >= 9) {
+ return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ } else if (aPipeAmount >= 4) {
+ return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ } else if (aThickNess < 0.124F) {
+ return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ } else if (aThickNess < 0.374F) {
+ return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ } else if (aThickNess < 0.499F) {
+ return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ } else if (aThickNess < 0.749F) {
+ return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ } else {
+ return aThickNess < 0.874F
+ ? new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa))
+ : new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex],
+ Dyes.getModulation(aColorIndex, aMaterial.mRGBa));
+ }
+ }
+
+ protected static final ITexture getRestrictorTexture(byte aMask) {
+ switch (aMask) {
+ case 1 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UP);
+ case 2 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DOWN);
+ case 3 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UD);
+ case 4 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LEFT);
+ case 5 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UL);
+ case 6 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DL);
+ case 7 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NR);
+ case 8 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_RIGHT);
+ case 9 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UR);
+ case 10 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DR);
+ case 11 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NL);
+ case 12 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LR);
+ case 13 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_ND);
+ case 14 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NU);
+ case 15 :
+ return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR);
+ default :
+ return null;
+ }
+ }
+
+
+ public final boolean isGT6Pipes() {
+ return StaticFields59.mGT6StylePipes;
+ }
+
+ public void updateHeatEntity() {
+ int amount = this.getMaxHeatEmittedPerTick() - this.HeatBuffer;
+ if (amount > 0) {
+ this.addtoHeatBuffer(this.fillHeatBuffer(amount));
+ }
+ }
+
+ public boolean facingMatchesDirection(ForgeDirection direction) {
+ return true;
+ }
+
+ public int maxrequestHeatTick(ForgeDirection directionFrom) {
+ return this.getMaxHeatEmittedPerTick();
+ }
+
+ public int requestHeat(ForgeDirection directionFrom, int requestheat) {
+ if (this.facingMatchesDirection(directionFrom)) {
+ int heatbuffertemp = this.getHeatBuffer();
+ if (this.getHeatBuffer() >= requestheat) {
+ this.setHeatBuffer(this.getHeatBuffer() - requestheat);
+ this.transmitHeat = requestheat;
+ return requestheat;
+ } else {
+ this.transmitHeat = heatbuffertemp;
+ this.setHeatBuffer(0);
+ return heatbuffertemp;
+ }
+ } else {
+ return 0;
+ }
+ }
+
+
+ public int getHeatBuffer() {
+ return this.HeatBuffer;
+ }
+
+ public void setHeatBuffer(int HeatBuffer) {
+ this.HeatBuffer = HeatBuffer;
+ }
+
+ public void addtoHeatBuffer(int heat) {
+ this.setHeatBuffer(this.getHeatBuffer() + heat);
+ }
+
+
+ public int fillHeatBuffer(int maxAmount) {
+ return maxAmount >= this.getMaxHeatEmittedPerTick() ? this.getMaxHeatEmittedPerTick() : maxAmount;
+ }
+
+ public int getMaxHeatEmittedPerTick() {
+ return (int) (this.mMaxTemp/1000);
+ }
+
+
+ public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY,
+ float aZ) {
+ if (isGT6Pipes()) {
+ byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ);
+ byte tMask = (byte) (1 << tSide);
+ if (aPlayer.isSneaking()) {
+ if (this.isInputDisabledAtSide(tSide)) {
+ this.mDisableInput = (byte) (this.mDisableInput & ~tMask);
+ GT_Utility.sendChatToPlayer(aPlayer, this.trans("212", "Input enabled"));
+ if (!this.isConnectedAtSide(tSide)) {
+ this.connect(tSide);
+ }
+ } else {
+ this.mDisableInput |= tMask;
+ GT_Utility.sendChatToPlayer(aPlayer, this.trans("213", "Input disabled"));
+ }
+ } else if (!this.isConnectedAtSide(tSide)) {
+ if (this.connect(tSide) > 0) {
+ GT_Utility.sendChatToPlayer(aPlayer, this.trans("214", "Connected"));
+ }
+ } else {
+ this.disconnect(tSide);
+ GT_Utility.sendChatToPlayer(aPlayer, this.trans("215", "Disconnected"));
+ }
+
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public boolean isInputDisabledAtSide(int aSide) {
+ return (this.mDisableInput & 1 << aSide) != 0;
+ }
+
+
+
+
+ @Override
+ public int maxHeatInPerTick(ForgeDirection var1) {
+ return (int) (this.mMaxTemp/500);
+ }
+
+ @Override
+ public int addHeat(ForgeDirection var1, int var2) {
+
+
+
+ /*ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing());
+ TileEntity te = this.getBaseMetaTileEntity().getWorld().getTileEntity(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY,
+ this.zCoord + dir.offsetZ);
+ if (te instanceof IHeatSource) {
+ int heatbandwith = ((IHeatSource) te).maxrequestHeatTick(dir.getOpposite());
+ double freeEUstorage = (double) this.maxEUStorage - this.EUstorage;
+ if (freeEUstorage >= this.productionpeerheat * (double) heatbandwith) {
+ this.receivedheat = ((IHeatSource) te).requestHeat(dir.getOpposite(), heatbandwith);
+ if (this.receivedheat != 0) {
+ this.production = (double) this.receivedheat * this.productionpeerheat;
+ this.EUstorage += this.production;
+ return true;
+ }
+ }
+ }
+
+ this.production = 0.0D;
+ this.receivedheat = 0;*/
+
+
+ return 0;
+ }
+
+ @Override
+ public int getTransmitHeat() {
+ return this.transmitHeat;
+ }
+
+
+
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java
index 5ce74588fa..8c0c47bea2 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java
@@ -6,7 +6,6 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Config;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils;
-import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy;
import gtPlusPlus.xmod.gregtech.common.StaticFields59;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import net.minecraft.entity.player.EntityPlayer;
@@ -24,7 +23,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch
super.onConfigLoad(aConfig);
if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) {
try {
- Integer a1 = (int) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "mPollutionSmogLimit");
+ Integer a1 = (int) StaticFields59.getFieldFromGregtechProxy(false, "mPollutionSmogLimit");
if (a1 != null && a1 > 0) {
mPollutionSmogLimit = a1;
}
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
index 5e41af86af..d6906c7b67 100644
--- a/