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.java54
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicBatteryBuffer.java5
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_BasicMachine_GT_Recipe.java314
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java37
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Output.java44
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_MultiBlockBase.java22
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Transformer.java23
7 files changed, 293 insertions, 206 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 267287c430..c55e346546 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
@@ -156,34 +156,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
return (int) mAmperage * 64;
}
- private void pullFromIc2EnergySources(IGregTechTileEntity aBaseMetaTileEntity) {
- if(!GT_Mod.gregtechproxy.ic2EnergySourceCompat) return;
-
- for( byte aSide = 0 ; aSide < 6 ; aSide++) if(isConnectedAtSide(aSide)) {
- final TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(aSide);
- final TileEntity tEmitter;
- if (tTileEntity instanceof IReactorChamber)
- tEmitter = (TileEntity) ((IReactorChamber) tTileEntity).getReactor();
- else tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity :
- EnergyNet.instance.getTileEntity(tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord);
-
- if (tEmitter instanceof IEnergySource) {
- final GT_CoverBehavior coverBehavior = aBaseMetaTileEntity.getCoverBehaviorAtSide(aSide);
- final int coverId = aBaseMetaTileEntity.getCoverIDAtSide(aSide),
- coverData = aBaseMetaTileEntity.getCoverDataAtSide(aSide);
- final ForgeDirection tDirection = ForgeDirection.getOrientation(GT_Utility.getOppositeSide(aSide));
-
- if (((IEnergySource) tEmitter).emitsEnergyTo((TileEntity) aBaseMetaTileEntity, tDirection) &&
- coverBehavior.letsEnergyIn(aSide, coverId, coverData, aBaseMetaTileEntity)) {
- final long tEU = (long) ((IEnergySource) tEmitter).getOfferedEnergy();
-
- if (transferElectricity(aSide, tEU, 1, Sets.newHashSet((TileEntity) aBaseMetaTileEntity)) > 0)
- ((IEnergySource) tEmitter).drawEnergy(tEU);
- }
- }
- }
- }
-
@Override
public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) {
if (!isConnectedAtSide(aSide) && aSide != 6)
@@ -205,9 +177,10 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
long rUsedAmperes = 0;
final IGregTechTileEntity baseMetaTile = getBaseMetaTileEntity();
-
+ byte i = (byte)((((aSide/2)*2)+2)%6); //this bit of trickery makes sure a direction goes to the next cardinal pair. IE, NS goes to E, EW goes to U, UD goes to N. It's a lame way to make sure locally connected machines on a wire get EU first.
aVoltage -= mCableLossPerMeter;
- if (aVoltage > 0) for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; i++)
+
+ if (aVoltage > 0) for (byte j = 0; j < 6 && aAmperage > rUsedAmperes; j++, i=(byte)((i+1)%6) )
if (i != aSide && isConnectedAtSide(i) && baseMetaTile.getCoverBehaviorAtSide(i).letsEnergyOut(i, baseMetaTile.getCoverIDAtSide(i), baseMetaTile.getCoverDataAtSide(i), baseMetaTile)) {
final TileEntity tTileEntity = baseMetaTile.getTileEntityAtSide(i);
@@ -323,8 +296,6 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
if (aBaseMetaTileEntity.isServerSide()) {
- if (GT_Mod.gregtechproxy.ic2EnergySourceCompat) pullFromIc2EnergySources(aBaseMetaTileEntity);
-
{ //amp handler
long worldTick = aBaseMetaTileEntity.getWorld().getTotalWorldTime();
@@ -603,4 +574,23 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
if (inputAABB.intersectsWith(aabb)) outputAABB.add(aabb);
}
}
+
+ @Override
+ public boolean shouldJoinIc2Enet() {
+ if (!GT_Mod.gregtechproxy.ic2EnergySourceCompat) return false;
+
+ if (mConnections != 0) {
+ final IGregTechTileEntity baseMeta = getBaseMetaTileEntity();
+ for( byte aSide = 0 ; aSide < 6 ; aSide++) if(isConnectedAtSide(aSide)) {
+ final TileEntity tTileEntity = baseMeta.getTileEntityAtSide(aSide);
+ final TileEntity tEmitter = (tTileEntity == null || tTileEntity instanceof IEnergyTile || EnergyNet.instance == null) ? tTileEntity :
+ EnergyNet.instance.getTileEntity(tTileEntity.getWorldObj(), tTileEntity.xCoord, tTileEntity.yCoord, tTileEntity.zCoord);
+
+ if (tEmitter instanceof IEnergyEmitter)
+ return true;
+
+ }
+ }
+ return false;
+ }
}
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 5835a6c9ab..1a81e4d570 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
@@ -240,6 +240,7 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
mChargeableCount++;
}
}
+ count++;
}
@Override
@@ -309,11 +310,11 @@ public class GT_MetaTileEntity_BasicBatteryBuffer extends GT_MetaTileEntity_Tier
@Override
public String[] getInfoData() {
- count++;
- if (mMax == 0 || count % 20 == 0) {
+ if (mMax == 0 || (count > 20)) {
long[] tmp = getStoredEnergy();
mStored = tmp[0];
mMax = tmp[1];
+ count = 0;
}
return new String[]{
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 72105f2074..353a62c319 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
@@ -1,5 +1,6 @@
package gregtech.api.metatileentity.implementations;
+import cpw.mods.fml.common.Loader;
import gregtech.api.enums.*;
import gregtech.api.gui.GT_Container_BasicMachine;
import gregtech.api.gui.GT_GUIContainer_BasicMachine;
@@ -9,9 +10,7 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_ModHandler.RecipeBits;
-import gregtech.api.util.GT_OreDictUnificator;
-import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
+import gregtech.api.util.GT_Recipe;
import gregtech.api.util.GT_Utility;
import ic2.core.Ic2Items;
import net.minecraft.entity.player.InventoryPlayer;
@@ -23,9 +22,7 @@ import net.minecraftforge.oredict.OreDictionary;
import java.util.Locale;
import java.util.Random;
-import static gregtech.api.enums.GT_Values.V;
-import static gregtech.api.enums.GT_Values.W;
-import static gregtech.api.enums.GT_Values.ticksBetweenSounds;
+import static gregtech.api.enums.GT_Values.*;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -34,70 +31,78 @@ import static gregtech.api.enums.GT_Values.ticksBetweenSounds;
* Extend this class to make a simple Machine
*/
public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_BasicMachine {
- private final GT_Recipe_Map mRecipes;
+ private final GT_Recipe.GT_Recipe_Map mRecipes;
private final int mTankCapacity, mSpecialEffect;
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;
- mTankCapacity = aTankCapacity;
- mSpecialEffect = aSpecialEffect;
- mRequiresFluidForFiltering = aRequiresFluidForFiltering;
- mRecipes = aRecipes;
- mSound = aSound;
- mGUIParameterA = (byte) aGUIParameterA;
- mGUIParameterB = (byte) aGUIParameterB;
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(int aID, String aName, String aNameRegional, int aTier, String aDescription, GT_Recipe.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 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")));
+ this.mSharedTank = aSharedTank;
+ this.mTankCapacity = aTankCapacity;
+ this.mSpecialEffect = aSpecialEffect;
+ this.mRequiresFluidForFiltering = aRequiresFluidForFiltering;
+ this.mRecipes = aRecipes;
+ this.mSound = aSound;
+ this.mGUIParameterA = (byte) aGUIParameterA;
+ this.mGUIParameterB = (byte) aGUIParameterB;
//TODO: CHECK
if (aRecipe != null) {
for (int i = 3; i < aRecipe.length; i++) {
- if (aRecipe[i] == X.CIRCUIT) {
- aRecipe[i] = Tier.ELECTRIC[mTier].mManagingObject;
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CIRCUIT) {
+ aRecipe[i] = Tier.ELECTRIC[this.mTier].mManagingObject;
continue;
}
- if (aRecipe[i] == X.BETTER_CIRCUIT) {
- aRecipe[i] = Tier.ELECTRIC[mTier].mBetterManagingObject;
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.BETTER_CIRCUIT) {
+ aRecipe[i] = Tier.ELECTRIC[this.mTier].mBetterManagingObject;
continue;
}
- if (aRecipe[i] == X.HULL) {
- aRecipe[i] = Tier.ELECTRIC[mTier].mHullObject;
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.HULL) {
+ aRecipe[i] = Tier.ELECTRIC[this.mTier].mHullObject;
continue;
}
- if (aRecipe[i] == X.WIRE) {
- aRecipe[i] = Tier.ELECTRIC[mTier].mConductingObject;
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE) {
+ aRecipe[i] = Tier.ELECTRIC[this.mTier].mConductingObject;
continue;
}
- if (aRecipe[i] == X.WIRE4) {
- aRecipe[i] = Tier.ELECTRIC[mTier].mLargerConductingObject;
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.WIRE4) {
+ aRecipe[i] = Tier.ELECTRIC[this.mTier].mLargerConductingObject;
continue;
}
- if (aRecipe[i] == X.GLASS) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.GLASS) {
+ switch (this.mTier) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ aRecipe[i] = new ItemStack(Blocks.glass, 1, W);
+ break;
+ case 4:
+ case 5:
case 6:
case 7:
case 8:
- case 9:
- case 10:
- case 11:
- case 12:
- case 13:
- case 14:
- case 15:
- aRecipe[i] = Ic2Items.reinforcedGlass;
- break;
+ if (Loader.isModLoaded("bartworks")) {
+ aRecipe[i] = "blockGlass"+VN[aTier];
+ break;
+ }
default:
- aRecipe[i] = new ItemStack(Blocks.glass, 1, W);
- break;
+ if (Loader.isModLoaded("bartworks")) {
+ aRecipe[i] = "blockGlass"+VN[8];
+ break;
+ } else {
+ aRecipe[i] = Ic2Items.reinforcedGlass;
+ break;
+ }
}
continue;
}
- if (aRecipe[i] == X.PLATE) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PLATE) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.plate.get(Materials.Steel);
@@ -120,9 +125,6 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = OrePrefixes.plate.get(Materials.HSSE);
break;
- case 8:
- aRecipe[i] = OrePrefixes.plate.get(Materials.Neutronium);
- break;
default:
aRecipe[i] = OrePrefixes.plate.get(Materials.Neutronium);
break;
@@ -130,8 +132,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.PIPE) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PIPE) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.pipeMedium.get(Materials.Bronze);
@@ -158,14 +160,14 @@ 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.Ultimate);
+ aRecipe[i] = OrePrefixes.pipeHuge.get(Materials.Ultimate);
break;
}
continue;
}
- if (aRecipe[i] == X.COIL_HEATING) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.wireGt02.get(Materials.AnyCopper);
@@ -191,6 +193,9 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 8:
aRecipe[i] = OrePrefixes.wireGt02.get(Materials.NaquadahAlloy);
break;
+ case 9:
+ aRecipe[i] = OrePrefixes.wireGt04.get(Materials.NaquadahAlloy);
+ break;
default:
aRecipe[i] = OrePrefixes.wireGt08.get(Materials.NaquadahAlloy);
break;
@@ -198,8 +203,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.COIL_HEATING_DOUBLE) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_HEATING_DOUBLE) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.wireGt04.get(Materials.AnyCopper);
@@ -225,6 +230,9 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 8:
aRecipe[i] = OrePrefixes.wireGt04.get(Materials.NaquadahAlloy);
break;
+ case 9:
+ aRecipe[i] = OrePrefixes.wireGt08.get(Materials.NaquadahAlloy);
+ break;
default:
aRecipe[i] = OrePrefixes.wireGt16.get(Materials.NaquadahAlloy);
break;
@@ -232,8 +240,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.STICK_DISTILLATION) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.STICK_DISTILLATION) {
+ switch (this.mTier) {
default:
aRecipe[i] = OrePrefixes.stick.get(Materials.Blaze);
break;
@@ -241,8 +249,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.STICK_MAGNETIC) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.STICK_MAGNETIC) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.stick.get(Materials.IronMagnetic);
@@ -266,8 +274,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.STICK_ELECTROMAGNETIC) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.STICK_ELECTROMAGNETIC) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.stick.get(Materials.AnyIron);
@@ -286,10 +294,10 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.COIL_ELECTRIC) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.COIL_ELECTRIC) {
+ switch (this.mTier) {
case 0:
- aRecipe[i] = OrePrefixes.wireGt01.get(Materials.Tin);
+ aRecipe[i] = OrePrefixes.wireGt01.get(Materials.Lead);
break;
case 1:
aRecipe[i] = OrePrefixes.wireGt02.get(Materials.Tin);
@@ -304,23 +312,23 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
aRecipe[i] = OrePrefixes.wireGt08.get(Materials.AnnealedCopper);
break;
case 5:
- aRecipe[i] = OrePrefixes.wireGt08.get(Materials.AnnealedCopper);
+ aRecipe[i] = OrePrefixes.wireGt16.get(Materials.AnnealedCopper);
break;
case 6:
aRecipe[i] = OrePrefixes.wireGt04.get(Materials.YttriumBariumCuprate);
break;
case 7:
- aRecipe[i] = OrePrefixes.wireGt08.get(Materials.SuperconductorUHV);
+ aRecipe[i] = OrePrefixes.wireGt08.get(Materials.Iridium);
break;
default:
- aRecipe[i] = OrePrefixes.wireGt16.get(Materials.SuperconductorUHV);
+ aRecipe[i] = OrePrefixes.wireGt16.get(Materials.Osmium);
break;
}
continue;
}
- if (aRecipe[i] == X.ROBOT_ARM) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROBOT_ARM) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Robot_Arm_LV;
@@ -343,15 +351,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Robot_Arm_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Robot_Arm_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Robot_Arm_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Robot_Arm_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.PUMP) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PUMP) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Electric_Pump_LV;
@@ -374,15 +388,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Electric_Pump_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Electric_Pump_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Electric_Pump_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Electric_Pump_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.ROTOR) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.ROTOR) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = OrePrefixes.rotor.get(Materials.Tin);
@@ -412,8 +432,8 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
continue;
}
- if (aRecipe[i] == X.MOTOR) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.MOTOR) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Electric_Motor_LV;
@@ -436,15 +456,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Electric_Motor_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Electric_Motor_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Electric_Motor_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Electric_Motor_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.PISTON) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.PISTON) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Electric_Piston_LV;
@@ -467,15 +493,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Electric_Piston_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Electric_Piston_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Electric_Piston_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Electric_Piston_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.CONVEYOR) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.CONVEYOR) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Conveyor_Module_LV;
@@ -498,15 +530,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Conveyor_Module_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Conveyor_Module_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Conveyor_Module_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Conveyor_Module_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.EMITTER) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.EMITTER) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Emitter_LV;
@@ -529,15 +567,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Emitter_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Emitter_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Emitter_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Emitter_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.SENSOR) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.SENSOR) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Sensor_LV;
@@ -560,15 +604,21 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Sensor_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Sensor_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Sensor_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Sensor_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] == X.FIELD_GENERATOR) {
- switch (mTier) {
+ if (aRecipe[i] == GT_MetaTileEntity_BasicMachine_GT_Recipe.X.FIELD_GENERATOR) {
+ switch (this.mTier) {
case 0:
case 1:
aRecipe[i] = ItemList.Field_Generator_LV;
@@ -591,50 +641,56 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
case 7:
aRecipe[i] = ItemList.Field_Generator_ZPM;
break;
- default:
+ case 8:
aRecipe[i] = ItemList.Field_Generator_UV;
break;
+ case 9:
+ aRecipe[i] = ItemList.Field_Generator_UHV;
+ break;
+ default:
+ aRecipe[i] = ItemList.Field_Generator_UEV;
+ break;
}
continue;
}
- if (aRecipe[i] instanceof X)
+ if (aRecipe[i] instanceof GT_MetaTileEntity_BasicMachine_GT_Recipe.X)
throw new IllegalArgumentException("MISSING TIER MAPPING FOR: " + aRecipe[i] + " AT TIER " + mTier);
}
- if (!GT_ModHandler.addCraftingRecipe(getStackForm(1), RecipeBits.DISMANTLEABLE | RecipeBits.BUFFERED | RecipeBits.NOT_REMOVABLE | RecipeBits.REVERSIBLE, aRecipe)) {
+ if (!GT_ModHandler.addCraftingRecipe(getStackForm(1), GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.BUFFERED | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE, aRecipe)) {
throw new IllegalArgumentException("INVALID CRAFTING RECIPE FOR: " + getStackForm(1).getDisplayName());
}
}
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName);
- mSharedTank = aSharedTank;
- mTankCapacity = aTankCapacity;
- mSpecialEffect = aSpecialEffect;
- mRequiresFluidForFiltering = aRequiresFluidForFiltering;
- mRecipes = aRecipes;
- mSound = aSound;
- mGUIParameterA = (byte) aGUIParameterA;
- mGUIParameterB = (byte) aGUIParameterB;
+ this.mSharedTank = aSharedTank;
+ this.mTankCapacity = aTankCapacity;
+ this.mSpecialEffect = aSpecialEffect;
+ this.mRequiresFluidForFiltering = aRequiresFluidForFiltering;
+ this.mRecipes = aRecipes;
+ this.mSound = aSound;
+ this.mGUIParameterA = (byte) aGUIParameterA;
+ this.mGUIParameterB = (byte) aGUIParameterB;
}
- public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String[] aDescription, GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
+ public GT_MetaTileEntity_BasicMachine_GT_Recipe(String aName, int aTier, String[] aDescription, GT_Recipe.GT_Recipe_Map aRecipes, int aInputSlots, int aOutputSlots, int aTankCapacity, int aAmperage, int aGUIParameterA, int aGUIParameterB, ITexture[][][] aTextures, String aGUIName, String aNEIName, String aSound, boolean aSharedTank, boolean aRequiresFluidForFiltering, int aSpecialEffect) {
super(aName, aTier, aAmperage, aDescription, aTextures, aInputSlots, aOutputSlots, aGUIName, aNEIName);
- mSharedTank = aSharedTank;
- mTankCapacity = aTankCapacity;
- mSpecialEffect = aSpecialEffect;
- mRequiresFluidForFiltering = aRequiresFluidForFiltering;
- mRecipes = aRecipes;
- mSound = aSound;
- mGUIParameterA = (byte) aGUIParameterA;
- mGUIParameterB = (byte) aGUIParameterB;
+ this.mSharedTank = aSharedTank;
+ this.mTankCapacity = aTankCapacity;
+ this.mSpecialEffect = aSpecialEffect;
+ this.mRequiresFluidForFiltering = aRequiresFluidForFiltering;
+ this.mRecipes = aRecipes;
+ this.mSound = aSound;
+ this.mGUIParameterA = (byte) aGUIParameterA;
+ this.mGUIParameterB = (byte) aGUIParameterB;
}
@Override
public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
- return new GT_MetaTileEntity_BasicMachine_GT_Recipe(mName, mTier, mDescriptionArray, mRecipes, mInputSlotCount, mOutputItems == null ? 0 : mOutputItems.length, mTankCapacity, mAmperage, mGUIParameterA, mGUIParameterB, mTextures, mGUIName, mNEIName, mSound, mSharedTank, mRequiresFluidForFiltering, mSpecialEffect);
+ return new GT_MetaTileEntity_BasicMachine_GT_Recipe(this.mName, this.mTier, this.mDescriptionArray, this.mRecipes, this.mInputSlotCount, this.mOutputItems == null ? 0 : this.mOutputItems.length, this.mTankCapacity, this.mAmperage, this.mGUIParameterA, this.mGUIParameterB, this.mTextures, this.mGUIName, this.mNEIName, this.mSound, this.mSharedTank, this.mRequiresFluidForFiltering, this.mSpecialEffect);
}
@Override
@@ -644,22 +700,22 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
- return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), mGUIName, GT_Utility.isStringValid(mNEIName) ? mNEIName : getRecipeList() != null ? getRecipeList().mUnlocalizedName : "", mGUIParameterA, mGUIParameterB);
+ return new GT_GUIContainer_BasicMachine(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), this.mGUIName, GT_Utility.isStringValid(this.mNEIName) ? this.mNEIName : this.getRecipeList() != null ? this.getRecipeList().mUnlocalizedName : "", this.mGUIParameterA, this.mGUIParameterB);
}
@Override
public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
if (!super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack)) return false;
- if (mInventory[aIndex] != null) return true;
- switch (mInputSlotCount) {
+ if (this.mInventory[aIndex] != null) return true;
+ switch (this.mInputSlotCount) {
case 0:
return false;
case 1:
- return getFillableStack() == null ? !mRequiresFluidForFiltering && getRecipeList().containsInput(aStack) : null != getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), new ItemStack[]{aStack});
+ return this.getFillableStack() == null ? !this.mRequiresFluidForFiltering && this.getRecipeList().containsInput(aStack) : null != this.getRecipeList().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, true, V[this.mTier], new FluidStack[]{this.getFillableStack()}, this.getSpecialSlot(), new ItemStack[]{aStack});
case 2:
- return (!mRequiresFluidForFiltering || getFillableStack() != null) && (((getInputAt(0) != null && getInputAt(1) != null) || (getInputAt(0) == null && getInputAt(1) == null ? getRecipeList().containsInput(aStack) : (getRecipeList().containsInput(aStack) && null != getRecipeList().findRecipe(getBaseMetaTileEntity(), mLastRecipe, true, V[mTier], new FluidStack[]{getFillableStack()}, getSpecialSlot(), aIndex == getInputSlot() ? new ItemStack[]{aStack, getInputAt(1)} : new ItemStack[]{getInputAt(0), aStack})))));
+ return (!this.mRequiresFluidForFiltering || this.getFillableStack() != null) && (((this.getInputAt(0) != null && this.getInputAt(1) != null) || (this.getInputAt(0) == null && this.getInputAt(1) == null ? this.getRecipeList().containsInput(aStack) : (this.getRecipeList().containsInput(aStack) && null != this.getRecipeList().findRecipe(this.getBaseMetaTileEntity(), this.mLastRecipe, true, V[this.mTier], new FluidStack[]{this.getFillableStack()}, this.getSpecialSlot(), aIndex == this.getInputSlot() ? new ItemStack[]{aStack, this.getInputAt(1)} : new ItemStack[]{this.getInputAt(0), aStack})))));
default:{
- int tID = getBaseMetaTileEntity().getMetaTileID();
+ int tID = this.getBaseMetaTileEntity().getMetaTileID();
if (tID >= 211 && tID <= 218 || tID >= 1180 && tID <= 1187 || tID >= 10780 && tID <= 10786) {//assembler lv-iv; circuit asseblers lv - uv; assemblers luv-uev
if (GT_Utility.isStackValid(aStack))
for (int oreID : OreDictionary.getOreIDs(aStack)) {
@@ -667,7 +723,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
return true;
}
}
- return getRecipeList().containsInput(aStack);
+ return this.getRecipeList().containsInput(aStack);
}
}
@@ -678,7 +734,7 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
super.onPreTick(aBaseMetaTileEntity, aTick);
if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
- switch (mSpecialEffect) {
+ switch (this.mSpecialEffect) {
case 0:
break;
case 1:
@@ -692,27 +748,27 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
}
@Override
- public GT_Recipe_Map getRecipeList() {
- return mRecipes;
+ public GT_Recipe.GT_Recipe_Map getRecipeList() {
+ return this.mRecipes;
}
@Override
public int getCapacity() {
- return mTankCapacity;
+ return this.mTankCapacity;
}
@Override
public void startSoundLoop(byte aIndex, double aX, double aY, double aZ) {
super.startSoundLoop(aIndex, aX, aY, aZ);
- if (aIndex == 1 && GT_Utility.isStringValid(mSound)) GT_Utility.doSoundAtClient(mSound, 100, 1.0F, aX, aY, aZ);
+ if (aIndex == 1 && GT_Utility.isStringValid(this.mSound)) GT_Utility.doSoundAtClient(this.mSound, 100, 1.0F, aX, aY, aZ);
}
@Override
public void startProcess() {
- BaseMetaTileEntity myMetaTileEntity = ((BaseMetaTileEntity)getBaseMetaTileEntity());
+ BaseMetaTileEntity myMetaTileEntity = ((BaseMetaTileEntity) this.getBaseMetaTileEntity());
// Added to throttle sounds. To reduce lag, this is on the server side so BlockUpdate packets aren't sent.
if (myMetaTileEntity.mTickTimer > (myMetaTileEntity.mLastSoundTick+ticksBetweenSounds)) {
- if (GT_Utility.isStringValid(mSound)) sendLoopStart((byte) 1);
+ if (GT_Utility.isStringValid(this.mSound)) this.sendLoopStart((byte) 1);
// Does not have overflow protection, but they are longs.
myMetaTileEntity.mLastSoundTick = myMetaTileEntity.mTickTimer;
}
@@ -720,18 +776,18 @@ public class GT_MetaTileEntity_BasicMachine_GT_Recipe extends GT_MetaTileEntity_
@Override
public FluidStack getFillableStack() {
- return mSharedTank ? getDrainableStack() : super.getFillableStack();
+ return this.mSharedTank ? this.getDrainableStack() : super.getFillableStack();
}
@Override
public FluidStack setFillableStack(FluidStack aFluid) {
- return mSharedTank ? setDrainableStack(aFluid) : super.setFillableStack(aFluid);
+ return this.mSharedTank ? this.setDrainableStack(aFluid) : super.setFillableStack(aFluid);
}
@Override
protected boolean displaysOutputFluid() {
- return !mSharedTank;
+ return !this.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 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_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
index d57aff8fc9..26e816a52c 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
@@ -43,19 +43,30 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- int textureIndex=actualTexture|(mTexturePage<<7);//Shift seven since one page is 128 textures!
- int texturePointer=(byte)(actualTexture&0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside
- return aSide != aFacing ?
- textureIndex > 0 ?
- new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]} :
- new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} :
- textureIndex > 0 ?
- aActive ?
- getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) :
- getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) :
- aActive ?
- getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) :
- getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
+ int textureIndex = actualTexture | (mTexturePage << 7);//Shift seven since one page is 128 textures!
+ int texturePointer = (byte) (actualTexture & 0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside
+ try {
+ if (aSide != aFacing) {
+ if (textureIndex > 0)
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]};
+ else
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ } else {
+ if (textureIndex > 0) {
+ if (aActive)
+ return getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
+ else
+ return getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
+ } else {
+ if (aActive)
+ return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
+ else
+ return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
+ }
+ }
+ } catch (NullPointerException npe) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][0]};
+ }
}
@Override
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 9c74811b23..71eea9bf87 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
@@ -10,9 +10,9 @@ import gregtech.api.util.GT_Utility;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;
-import net.minecraftforge.fluids.FluidStack;
-import net.minecraftforge.fluids.IFluidHandler;
+import net.minecraftforge.fluids.*;
public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
private String lockedFluidName = null;
@@ -207,7 +207,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
playerThatLockedfluid = aPlayer;
if (mFluid == null) {
this.setLockedFluidName(null);
- inBrackets = trans("115.3","currently none, will be locked to the next that is put in");
+ inBrackets = trans("115.3","currently none, will be locked to the next that is put in (or use fluid cell to lock)");
} else {
this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName());
inBrackets = this.getDrainableStack().getLocalizedName();
@@ -218,7 +218,7 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
playerThatLockedfluid = aPlayer;
if (mFluid == null) {
this.setLockedFluidName(null);
- inBrackets = trans("115.3","currently none, will be locked to the next that is put in");
+ inBrackets = trans("115.3","currently none, will be locked to the next that is put in (or use fluid cell to lock)");
} else {
this.setLockedFluidName(this.getDrainableStack().getUnlocalizedName());
inBrackets = this.getDrainableStack().getLocalizedName();
@@ -227,7 +227,41 @@ public class GT_MetaTileEntity_Hatch_Output extends GT_MetaTileEntity_Hatch {
break;
}
}
-
+ private boolean tryToLockHatch(EntityPlayer aPlayer, byte aSide) {
+ if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).isGUIClickable(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity()))
+ return false;
+ if (!isFluidLocked())
+ return false;
+ ItemStack tCurrentItem = aPlayer.inventory.getCurrentItem();
+ if (tCurrentItem == null)
+ return false;
+ FluidStack tFluid = FluidContainerRegistry.getFluidForFilledItem(tCurrentItem);
+ if (tFluid == null && tCurrentItem.getItem() instanceof IFluidContainerItem)
+ tFluid = ((IFluidContainerItem)tCurrentItem.getItem()).getFluid(tCurrentItem);
+ if (tFluid != null) {
+ if (getLockedFluidName() != null && !getLockedFluidName().equals(tFluid.getUnlocalizedName())) {
+ GT_Utility.sendChatToPlayer(aPlayer, String.format("%s %s", trans("151.3",
+ "Hatch is locked to a different fluid. To change the locking, empty it and made it locked to the next fluid with a screwdriver. Currently locked to")
+ , StatCollector.translateToLocal(getLockedFluidName())));
+ }
+ else {
+ setLockedFluidName(tFluid.getUnlocalizedName());
+ if (mMode == 8)
+ GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", trans("151.1", "Outputs items and 1 specific Fluid"), tFluid.getLocalizedName()));
+ else
+ GT_Utility.sendChatToPlayer(aPlayer, String.format("%s (%s)", trans("151.2", "Outputs 1 specific Fluid"), tFluid.getLocalizedName()));
+ }
+ return true;
+ }
+ return false;
+ }
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer, byte aSide, float aX, float aY, float aZ) {
+ if (tryToLockHatch(aPlayer, aSide))
+ return true;
+ return super.onRightclick(aBaseMetaTileEntity, aPlayer, aSide, aX, aY, aZ);
+ }
+
public String trans(String aKey, String aEnglish){
return GT_LanguageManager.addStringLocalization("Interaction_DESCRIPTION_Index_"+aKey, aEnglish, false);
}
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 2da97a1939..da80a9e231 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
@@ -8,8 +8,6 @@ import java.util.ArrayList;
import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.ConfigCategories;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.OrePrefixes;
import gregtech.api.gui.GT_Container_MultiMachine;
import gregtech.api.gui.GT_GUIContainer_MultiMachine;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
@@ -19,7 +17,6 @@ import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.objects.GT_ItemStack;
import gregtech.api.util.GT_Log;
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;
@@ -435,7 +432,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
NBTTagCompound tNBT = mInventory[1].getTagCompound();
if (tNBT != null) {
NBTTagCompound tNBT2 = tNBT.getCompoundTag("GT.CraftingComponents");//tNBT2 dont use out if
- if (!tNBT.getBoolean("mDis")) {
+ /*if (!tNBT.getBoolean("mDis")) {
tNBT2 = new NBTTagCompound();
Materials tMaterial = GT_MetaGenerated_Tool.getPrimaryMaterial(mInventory[1]);
ItemStack tTurbine = GT_OreDictUnificator.get(OrePrefixes.turbineBlade, tMaterial, 1);
@@ -487,7 +484,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
tNBT.setBoolean("mDis", true);
mInventory[1].setTagCompound(tNBT);
- }
+ }*/
}
((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;
@@ -566,7 +563,7 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
//Isnt too low EUt check?
int aAmpsToInject;
int aRemainder;
-
+ int ampsOnCurrentHatch;
//xEUt *= 4;//this is effect of everclocking
for (GT_MetaTileEntity_Hatch_Dynamo aDynamo : mDynamoHatches) {
if (isValidMetaTileEntity(aDynamo)) {
@@ -574,11 +571,14 @@ public abstract class GT_MetaTileEntity_MultiBlockBase extends MetaTileEntity {
aVoltage = aDynamo.maxEUOutput();
aAmpsToInject = (int) (leftToInject / aVoltage);
aRemainder = (int) (leftToInject - (aAmpsToInject * aVoltage));
- long powerGain;
- for (int i = 0; i < Math.min(aDynamo.maxAmperesOut(), aAmpsToInject > 0 ? aAmpsToInject : 1); i++) {
- powerGain = aAmpsToInject > 0 ? aVoltage : aRemainder;
- aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(powerGain, false);
- injected += powerGain;
+ ampsOnCurrentHatch= (int) Math.min(aDynamo.maxAmperesOut(), aAmpsToInject);
+ for (int i = 0; i < ampsOnCurrentHatch; i++) {
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aVoltage, false);
+ }
+ injected+=aVoltage*ampsOnCurrentHatch;
+ if(aRemainder>0 && ampsOnCurrentHatch<aDynamo.maxAmperesOut()){
+ aDynamo.getBaseMetaTileEntity().increaseStoredEnergyUnits(aRemainder, false);
+ injected+=aRemainder;
}
}
}
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 fd183d9e79..f33b8aa3d9 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
@@ -1,6 +1,5 @@
package gregtech.api.metatileentity.implementations;
-import appeng.api.parts.IPartHost;
import cofh.api.energy.IEnergyProvider;
import cofh.api.energy.IEnergyStorage;
import crazypants.enderio.machine.capbank.TileCapBank;
@@ -12,8 +11,6 @@ import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.util.GT_Utility;
-import ic2.api.energy.tile.IEnergySource;
-import ic2.api.reactor.IReactorChamber;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@@ -143,27 +140,20 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
@Override
public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aBaseMetaTileEntity.isServerSide()) {
+ if (aBaseMetaTileEntity.isServerSide() && GregTech_API.mInputRF) {
aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork());
for (byte i = 0; i < 6 && aBaseMetaTileEntity.getStoredEU() < aBaseMetaTileEntity.getEUCapacity(); i++)
if (aBaseMetaTileEntity.inputEnergyFrom(i)) {
TileEntity tTileEntity = aBaseMetaTileEntity.getTileEntityAtSide(i);
- if (tTileEntity instanceof IReactorChamber) {
- tTileEntity = (TileEntity) ((IReactorChamber) tTileEntity).getReactor();
- }
- if (tTileEntity instanceof IEnergySource && !(tTileEntity instanceof IPartHost) && ((IEnergySource) tTileEntity).emitsEnergyTo((TileEntity) aBaseMetaTileEntity, ForgeDirection.getOrientation(GT_Utility.getOppositeSide(i)))) {
- long tEU = Math.min(maxEUInput(), (long) ((IEnergySource) tTileEntity).getOfferedEnergy());
- ((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) {
+ if (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)), 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) {
+ } else if (tTileEntity instanceof IEnergyStorage && ((IEnergyStorage) tTileEntity).extractEnergy(1, true) == 1) {
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) {
+ } else if (GregTech_API.meIOLoaded && tTileEntity instanceof IPowerContainer && ((IPowerContainer) tTileEntity).getEnergyStored() > 0) {
int storedRF = ((IPowerContainer) tTileEntity).getEnergyStored();
int extractRF = GT_Utility.safeInt(maxEUInput() * 100L / GregTech_API.mRFtoEU);
long tEU = 0;
@@ -226,4 +216,9 @@ public class GT_MetaTileEntity_Transformer extends GT_MetaTileEntity_TieredMachi
maxAmperesOut() +
trans("149","A");
}
+
+ @Override
+ public boolean shouldJoinIc2Enet() {
+ return true;
+ }
}