diff options
Diffstat (limited to 'src/Java/gtPlusPlus/xmod/gregtech/common')
6 files changed, 609 insertions, 78 deletions
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java index f47e1d5b72..b3366df96b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java @@ -2,7 +2,9 @@ package gtPlusPlus.xmod.gregtech.common.blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; - +import net.minecraft.world.IBlockAccess; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.objects.GT_CopiedBlockTexture; @@ -11,6 +13,7 @@ import gregtech.common.blocks.GT_Material_Casings; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler; public class GregtechMetaCasingBlocks4 @@ -53,10 +56,24 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); GregtechItemList.Casing_TeslaTower.set(new ItemStack(this, 1, 14)); GregtechItemList.Casing_PLACEHOLDER_TreeFarmer.set(new ItemStack(this, 1, 15));*/ - } + } + private static final LargeTurbineTextureHandler mTurbineTextures = new LargeTurbineTextureHandler(); + + @Override + @SideOnly(Side.CLIENT) + public IIcon getIcon(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide) { + final GregtechMetaCasingBlocks4 i = this; + return mTurbineTextures.handleCasingsGT(aWorld, xCoord, yCoord, zCoord, aSide, i); + } + @Override - public IIcon getIcon(final int aSide, final int aMeta) { //Texture ID's. case 0 == ID[57] + public IIcon getIcon(final int aSide, final int aMeta) { + return getStaticIcon((byte) aSide, (byte) aMeta); + } + + public static IIcon getStaticIcon(final byte aSide, final byte aMeta) { + //Texture ID's. case 0 == ID[57] if ((aMeta >= 0) && (aMeta < 16)) { switch (aMeta) { //Centrifuge @@ -81,15 +98,18 @@ extends GregtechMetaCasingBlocksAbstract { case 6: return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); + //Vanadium Radox Battery case 7: return TexturesGtBlock.Casing_Redox_1.getIcon(); //Power Sub-Station Casing case 8: - return TexturesGtBlock.Casing_Machine_Metal_Sheet_A.getIcon(); + return TexturesGtBlock.Casing_Machine_Simple_Top.getIcon(); //Cyclotron Coil case 9: - return TexturesGtBlock.Overlay_Machine_Cyber_A.getIcon(); + return TexturesGtBlock.Casing_Material_MaragingSteel.getIcon(); + + //Cyclotron External Casing case 10: return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon(); @@ -110,15 +130,6 @@ extends GregtechMetaCasingBlocksAbstract { case 14: return TexturesGtBlock.Casing_Material_RedSteel.getIcon(); case 15: - if (aSide <2) { - if (aSide == 1) { - return TexturesGtBlock.Casing_Machine_Podzol.getIcon(); - } - return TexturesGtBlock.Casing_Machine_Acacia_Log.getIcon(); - } - else { - return TexturesGtBlock.Casing_Machine_Farm_Manager.getIcon(); - } default: return TexturesGtBlock.Overlay_UU_Matter.getIcon(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 2e05d08bb1..5f49528724 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -524,6 +524,10 @@ public class TexturesGtBlock { + public static Object Casing_Material_Turbine; + + + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java new file mode 100644 index 0000000000..188b6ed4f6 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/turbine/LargeTurbineTextureHandler.java @@ -0,0 +1,310 @@ +package gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine; + +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine; +import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks4; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; + +public class LargeTurbineTextureHandler { + + /** + * LP Turbines + */ + private static CustomIcon aTex1_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_1"); + private static CustomIcon aTex1 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_1"); + private static CustomIcon aTex2_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_2"); + private static CustomIcon aTex2 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_2"); + private static CustomIcon aTex3_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_3"); + private static CustomIcon aTex3 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_3"); + private static CustomIcon aTex4_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_4"); + private static CustomIcon aTex4 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_4"); + private static CustomIcon aTex5_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_5"); + private static CustomIcon aTex5 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_5"); + private static CustomIcon aTex6_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_6"); + private static CustomIcon aTex6 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_6"); + private static CustomIcon aTex7_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_7"); + private static CustomIcon aTex7 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_7"); + private static CustomIcon aTex8_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_8"); + private static CustomIcon aTex8 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_8"); + private static CustomIcon aTex9_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_ACTIVE_9"); + private static CustomIcon aTex9 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_LP_9"); + + private static CustomIcon frontFace_0 = (aTex1); + private static CustomIcon frontFaceActive_0 = (aTex1_Active); + private static CustomIcon frontFace_1 = (aTex2); + private static CustomIcon frontFaceActive_1 = (aTex2_Active); + private static CustomIcon frontFace_2 = (aTex3); + private static CustomIcon frontFaceActive_2 = (aTex3_Active); + private static CustomIcon frontFace_3 = (aTex4); + private static CustomIcon frontFaceActive_3 = (aTex4_Active); + public static CustomIcon frontFace_4 = (aTex5); + public static CustomIcon frontFaceActive_4 = (aTex5_Active); + private static CustomIcon frontFace_5 = (aTex6); + private static CustomIcon frontFaceActive_5 = (aTex6_Active); + private static CustomIcon frontFace_6 = (aTex7); + private static CustomIcon frontFaceActive_6 = (aTex7_Active); + private static CustomIcon frontFace_7 = (aTex8); + private static CustomIcon frontFaceActive_7 = (aTex8_Active); + private static CustomIcon frontFace_8 = (aTex9); + private static CustomIcon frontFaceActive_8 = (aTex9_Active); + + CustomIcon[] OVERLAY_LP_TURBINE = new CustomIcon[]{ + frontFace_0, + frontFace_1, + frontFace_2, + frontFace_3, + frontFace_4, + frontFace_5, + frontFace_6, + frontFace_7, + frontFace_8 + }; + + CustomIcon[] OVERLAY_LP_TURBINE_ACTIVE = new CustomIcon[]{ + frontFaceActive_0, + frontFaceActive_1, + frontFaceActive_2, + frontFaceActive_3, + frontFaceActive_4, + frontFaceActive_5, + frontFaceActive_6, + frontFaceActive_7, + frontFaceActive_8 + }; + + + /** + * HP Turbines + */ + private static CustomIcon aTexHP1_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_1"); + private static CustomIcon aTexHP1 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_1"); + private static CustomIcon aTexHP2_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_2"); + private static CustomIcon aTexHP2 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_2"); + private static CustomIcon aTexHP3_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_3"); + private static CustomIcon aTexHP3 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_3"); + private static CustomIcon aTexHP4_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_4"); + private static CustomIcon aTexHP4 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_4"); + private static CustomIcon aTexHP5_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_5"); + private static CustomIcon aTexHP5 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_5"); + private static CustomIcon aTexHP6_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_6"); + private static CustomIcon aTexHP6 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_6"); + private static CustomIcon aTexHP7_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_7"); + private static CustomIcon aTexHP7 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_7"); + private static CustomIcon aTexHP8_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_8"); + private static CustomIcon aTexHP8 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_8"); + private static CustomIcon aTexHP9_Active = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_ACTIVE_9"); + private static CustomIcon aTexHP9 = new CustomIcon("iconsets/BigTurbine/LARGE_TURBINE_HP_9"); + + private static CustomIcon frontFaceHP_0 = (aTexHP1); + private static CustomIcon frontFaceHPActive_0 = (aTexHP1_Active); + private static CustomIcon frontFaceHP_1 = (aTexHP2); + private static CustomIcon frontFaceHPActive_1 = (aTexHP2_Active); + private static CustomIcon frontFaceHP_2 = (aTexHP3); + private static CustomIcon frontFaceHPActive_2 = (aTexHP3_Active); + private static CustomIcon frontFaceHP_3 = (aTexHP4); + private static CustomIcon frontFaceHPActive_3 = (aTexHP4_Active); + public static CustomIcon frontFaceHP_4 = (aTexHP5); + public static CustomIcon frontFaceHPActive_4 = (aTexHP5_Active); + private static CustomIcon frontFaceHP_5 = (aTexHP6); + private static CustomIcon frontFaceHPActive_5 = (aTexHP6_Active); + private static CustomIcon frontFaceHP_6 = (aTexHP7); + private static CustomIcon frontFaceHPActive_6 = (aTexHP7_Active); + private static CustomIcon frontFaceHP_7 = (aTexHP8); + private static CustomIcon frontFaceHPActive_7 = (aTexHP8_Active); + private static CustomIcon frontFaceHP_8 = (aTexHP9); + private static CustomIcon frontFaceHPActive_8 = (aTexHP9_Active); + + CustomIcon[] OVERLAY_HP_TURBINE = new CustomIcon[]{ + frontFaceHP_0, + frontFaceHP_1, + frontFaceHP_2, + frontFaceHP_3, + frontFaceHP_4, + frontFaceHP_5, + frontFaceHP_6, + frontFaceHP_7, + frontFaceHP_8 + }; + + CustomIcon[] OVERLAY_HP_TURBINE_ACTIVE = new CustomIcon[]{ + frontFaceHPActive_0, + frontFaceHPActive_1, + frontFaceHPActive_2, + frontFaceHPActive_3, + frontFaceHPActive_4, + frontFaceHPActive_5, + frontFaceHPActive_6, + frontFaceHPActive_7, + frontFaceHPActive_8 + }; + + + + public IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord, final int aSide, final GregtechMetaCasingBlocks4 thisBlock) { + final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord); + + //7 - shaft + //8 LP + //9 HP + + CustomIcon[] mGetCurrentTextureSet = null, mGetCurrentTextureSet_ACTIVE = null; + + + if (tMeta <= 6 || tMeta >= 10) { + return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta); + } + else { + if (tMeta == 8) { + mGetCurrentTextureSet = OVERLAY_LP_TURBINE; + mGetCurrentTextureSet_ACTIVE = OVERLAY_LP_TURBINE_ACTIVE; + } + else if (tMeta == 9) { + mGetCurrentTextureSet = OVERLAY_HP_TURBINE; + mGetCurrentTextureSet_ACTIVE = OVERLAY_HP_TURBINE_ACTIVE; + } + if (mGetCurrentTextureSet == null || mGetCurrentTextureSet_ACTIVE == null) { + return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta); + } + + + + if ((aSide == 2) || (aSide == 3)) { + TileEntity tTileEntity; + IMetaTileEntity tMetaTileEntity; + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[0].getIcon(); + } + return mGetCurrentTextureSet[0].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[3].getIcon(); + } + return mGetCurrentTextureSet[3].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[6].getIcon(); + } + return mGetCurrentTextureSet[6].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[1].getIcon(); + } + return mGetCurrentTextureSet[1].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[7].getIcon(); + } + return mGetCurrentTextureSet[7].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[8].getIcon(); + } + return mGetCurrentTextureSet[8].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[5].getIcon(); + } + return mGetCurrentTextureSet[5].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[2].getIcon(); + } + return mGetCurrentTextureSet[2].getIcon(); + } + } else if ((aSide == 4) || (aSide == 5)) { + TileEntity tTileEntity; + Object tMetaTileEntity; + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[0].getIcon(); + } + return mGetCurrentTextureSet[0].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[3].getIcon(); + } + return mGetCurrentTextureSet[3].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[6].getIcon(); + } + return mGetCurrentTextureSet[6].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[1].getIcon(); + } + return mGetCurrentTextureSet[1].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[7].getIcon(); + } + return mGetCurrentTextureSet[7].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[8].getIcon(); + } + return mGetCurrentTextureSet[8].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[5].getIcon(); + } + return mGetCurrentTextureSet[5].getIcon(); + } + if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine))) { + if (isUsingAnimatedTexture(tTileEntity)) { + return mGetCurrentTextureSet_ACTIVE[2].getIcon(); + } + return mGetCurrentTextureSet[2].getIcon(); + } + } + } + return GregtechMetaCasingBlocks4.getStaticIcon((byte) aSide, (byte) tMeta); + } + + public boolean isUsingAnimatedTexture(TileEntity tTileEntity) { + boolean aVal = true; + /*IGregTechTileEntity aTile; + if (tTileEntity instanceof IGregTechTileEntity) { + aTile = (IGregTechTileEntity) tTileEntity; + if (aTile != null) { + final IMetaTileEntity aMetaTileEntity = aTile.getMetaTileEntity(); + if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) { + aVal = ((GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity).isControllerActive(); + Logger.INFO("Returning "+aVal+" as Rotor Assembly controller status"); + } + } + } */ + return aVal; + } + + public GT_MetaTileEntity_Hatch_Turbine isTurbineHatch(final IGregTechTileEntity aTileEntity) { + if (aTileEntity != null) { + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity != null && aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) { + return (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity; + } + } + return null; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java index e57fbed1f8..c244831f6f 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_SHSteam.java @@ -3,12 +3,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.t import java.util.ArrayList; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; @@ -33,14 +29,9 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu super(aName); } - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TI_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_TI5) : Textures.BlockIcons.CASING_BLOCKS[getTAE()]}; - } - public String[] getDescription() { if (mCasingName.toLowerCase().contains(".name")) { - mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 7); + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 9); } return new String[]{ "Controller Block for the XL High Pressure Steam Turbine", @@ -62,7 +53,7 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu @Override public Block getCasingBlock() { - return GregTech_API.sBlockCasings4; + return ModBlocks.blockCasings4Misc; } @Override @@ -111,7 +102,7 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu totalFlow += flow; // track total input used if (!achievement) { try { - GT_Mod.instance.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "efficientsteam"); + GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "efficientsteam"); } catch (Exception e) { } achievement = true; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java index 27b5f9a774..0d667575c5 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GT_MTE_LargeTurbine_Steam.java @@ -5,13 +5,8 @@ import static gtPlusPlus.core.lib.CORE.RANDOM; import java.util.ArrayList; import gregtech.GT_Mod; -import gregtech.api.GregTech_API; -import gregtech.api.enums.TAE; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.block.ModBlocks; @@ -37,14 +32,9 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb super(aName); } - @Override - public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { - return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? aActive ? new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_ST_ACTIVE5) : new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE_ST5) : Textures.BlockIcons.CASING_BLOCKS[getTAE()]}; - } - public String[] getDescription() { if (mCasingName.toLowerCase().contains(".name")) { - mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 7); + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, 8); } return new String[]{ "Controller Block for the XL Steam Turbine", @@ -66,7 +56,7 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb @Override public Block getCasingBlock() { - return GregTech_API.sBlockCasings4; + return ModBlocks.blockCasings4Misc; } @Override @@ -121,7 +111,7 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb remainingFlow -= flow; // track amount we're allowed to continue depleting from hatches totalFlow += flow; // track total input used if (!achievement) { - GT_Mod.instance.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam"); + GT_Mod.achievements.issueAchievement(this.getBaseMetaTileEntity().getWorld().getPlayerEntityByName(this.getBaseMetaTileEntity().getOwnerName()), "muchsteam"); achievement = true; } }else if(fluidName.equals("ic2.fluidSuperheatedSteam")){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java index ea27472236..54f16e1944 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/turbines/GregtechMetaTileEntity_LargerTurbineBase.java @@ -4,19 +4,31 @@ import java.util.ArrayList; import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; +import gregtech.api.enums.Textures; import gregtech.api.gui.GT_GUIContainer_MultiMachine; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler; +import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.minecraft.BlockPos; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Turbine; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.turbine.LargeTurbineTextureHandler; import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -35,16 +47,27 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM private final int mCasingTextureID; public static String mCasingName; + + public ArrayList<GT_MetaTileEntity_Hatch_Turbine> mTurbineRotorHatches = new ArrayList<GT_MetaTileEntity_Hatch_Turbine>(); public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional) { super(aID, aName, aNameRegional); mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta()); mCasingTextureID = getTAE(); + GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4; + GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4; + frontFaceActive = new GT_RenderedTexture(GT9_5_Active); + frontFace = new GT_RenderedTexture(GT9_5); + } public GregtechMetaTileEntity_LargerTurbineBase(String aName) { super(aName); mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta()); mCasingTextureID = getTAE(); + GT9_5_Active = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFaceActive_4 : LargeTurbineTextureHandler.frontFaceHPActive_4; + GT9_5 = getCasingMeta() == 8 ? LargeTurbineTextureHandler.frontFace_4 : LargeTurbineTextureHandler.frontFaceHP_4; + frontFaceActive = new GT_RenderedTexture(GT9_5_Active); + frontFace = new GT_RenderedTexture(GT9_5); } public final int getTAE() { @@ -67,23 +90,40 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { return checkMachine2(aBaseMetaTileEntity, aStack); - } - public boolean checkMachine2(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - int depth = 1; //9 high //7x7 + this.mDynamoHatches.clear(); - for (int i=0;i>=-9;i--) { + this.mTurbineRotorHatches.clear(); + this.mMaintenanceHatches.clear(); + this.mMufflerHatches.clear(); + this.mInputHatches.clear(); + this.mOutputHatches.clear(); + + for (int i=0;i>-9;i--) { if (!getLayer(i)) { Logger.INFO("Bad Layer: "+(+i)); return false; } - } - if (mMaintenanceHatches.size() != 1 || mDynamoHatches.size() < 1 || mMufflerHatches.size() < 4) { - Logger.INFO("Bad Hatches"); + } + + Logger.INFO("Hatches | Found "+mTurbineRotorHatches.size()+" Rotor Assemblies, "+12+" are required."); + Logger.INFO("Hatches | Found "+mMaintenanceHatches.size()+" Maint. hatches, "+1+" are required."); + Logger.INFO("Hatches | Found "+mDynamoHatches.size()+" Dynamos, "+1+" or more are required."); + Logger.INFO("Hatches | Found "+mMufflerHatches.size()+" Mufflers, "+4+" are required."); + Logger.INFO("Hatches | Found "+mInputHatches.size()+" Input Hatches, "+1+" or more are required."); + Logger.INFO("Hatches | Found "+mOutputHatches.size()+" Output Hatches, "+1+" ore more are required."); + + if (mTurbineRotorHatches.size() != 12 || + mMaintenanceHatches.size() != 1 || + mDynamoHatches.size() < 1 || + mMufflerHatches.size() != 4 || + mInputHatches.size() < 1 || + mOutputHatches.size() < 1 + ) { return false; } Logger.INFO("Built Structure"); @@ -92,7 +132,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM public boolean getLayer(int aY) { - if (aY == 0 || aY == 2 || aY == 3 || aY == 5 || aY == 6 || aY == 8) { + if (aY == 0 || aY == -2 || aY == -3 || aY == -5 || aY == -6 || aY == -8) { return checkNormalLayer(aY); } else { @@ -107,21 +147,27 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM for (int z = -3; z <= 3; z++) { tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); + IGregTechTileEntity tTileEntity; if (aY == 0 && x == 0 && z == 0) { - Logger.INFO("GOOD 1"); - continue; - } - - else if (tBlock == getCasingBlock() && tMeta == getCasingMeta()) { - Logger.INFO("GOOD 0"); continue; - } else if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) { - Logger.INFO("GOOD 2"); + } + else if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) || + ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) { + tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); + if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) { + Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName()); + continue; + } + } + else if (isValidCasingBlock(tBlock, tMeta)) { continue; - } else { - Logger.INFO("BAD 1"); + } else { + if (tBlock != null) { + log("Offset: "+x+", "+aY+", "+z); + log("Found "+tBlock.getLocalizedName()+" with Meta "+tMeta); + log("Expected "+getCasingBlock().getLocalizedName()+" with Meta "+getCasingMeta()); + } return false; } } @@ -139,7 +185,8 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM } } - public boolean checkTurbineLayerX(int aY) { + public boolean checkTurbineLayerX(int aY) { + Logger.INFO("checking X"); Block tBlock; int tMeta; for (int x = -3; x <= 3; x++) { @@ -147,14 +194,30 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - if (x == 0 || z == 0) { + if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) || + ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) { IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) { + Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName()); continue; - } - } + } + } + if (x == -2 || x == 2) { + + //Find Hatches on the ends + if (z == -3 || z == 3) { + IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); + if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) { + log("Found x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z); + continue; + } + else { + log("Missing x axis Turbine Assembly at Offset: "+x+", "+aY+", "+z); + } + } + if (isValidTurbineBlock(tBlock, tMeta)) { continue; } @@ -176,6 +239,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM } public boolean checkTurbineLayerZ(int aY) { + Logger.INFO("checking Z"); Block tBlock; int tMeta; for (int x = -3; x <= 3; x++) { @@ -183,14 +247,29 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - if (x == 0 || z == 0) { + if ((x == 0 && z == -3) || (x == 0 && z == 3) || (x == 3 && z == 0) || (x == -3 && z == 0) || + ((aY == 0) && (x == 0 && z == -2) || (x == 0 && z == 2) || (x == 2 && z == 0) || (x == -2 && z == 0))) { IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) { + Logger.INFO("Added Hatch at offset "+x+", "+aY+", "+z+" | Type: "+tTileEntity.getInventoryName()); continue; - } + } } if (z == -2 || z == 2) { + + //Find Hatches on the ends + if (x == -3 || x == 3) { + IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); + if (this.addTurbineHatch(tTileEntity, this.mCasingTextureID)) { + log("Found z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z); + continue; + } + else { + log("Missing z axis Turbine Assembly at Offset: "+x+", "+aY+", "+z); + } + } + if (isValidTurbineBlock(tBlock, tMeta)) { continue; } @@ -218,7 +297,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM if (Block.isEqualTo(aBlock, getCasingBlock()) && (int) aMeta == (int) getCasingMeta()) { return true; } - Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMeta()); + log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMeta()); return false; } @@ -226,7 +305,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM if (aBlock == getCasingBlock() && aMeta == getCasingMetaTurbine()) { return true; } - Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + "With Meta "+aMeta); + log("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + " With Meta "+aMeta+", Expected "+getCasingBlock().getLocalizedName()+" With Meta "+getCasingMetaTurbine()); return false; } @@ -243,16 +322,6 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM public abstract byte getCasingTextureIndex(); @Override - public void saveNBTData(NBTTagCompound aNBT) { - super.saveNBTData(aNBT); - } - - @Override - public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - } - - @Override public boolean checkRecipe(ItemStack aStack) { if((counter&7)==0 && (aStack==null || !(aStack.getItem() instanceof GT_MetaGenerated_Tool) || aStack.getItemDamage() < 170 || aStack.getItemDamage() >179)) { stopMachine(); @@ -266,7 +335,7 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM baseEff = GT_Utility.safeInt((long)((5F + ((GT_MetaGenerated_Tool) aStack.getItem()).getToolCombatDamage(aStack)) * 1000F)); optFlow = GT_Utility.safeInt((long)Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool) aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() - * ((GT_MetaGenerated_Tool) aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed + * GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mToolSpeed * 50)); if(optFlow<=0 || baseEff<=0){ stopMachine();//in case the turbine got removed @@ -276,6 +345,9 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM counter++; } } + else { + Logger.INFO("Did not find any valid input fluids."); + } int newPower = fluidIntoPower(tFluids, optFlow, baseEff); // How much the turbine should be producing with this flow int difference = newPower - this.mEUt; // difference between current output and new output @@ -287,8 +359,9 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM if (Math.abs(difference) > maxChangeAllowed) { // If this difference is too big, use the maximum allowed change int change = maxChangeAllowed * (difference > 0 ? 1 : -1); // Make the change positive or negative. this.mEUt += change; // Apply the change - } else + } else { this.mEUt = newPower; + } if (this.mEUt <= 0) { //stopMachine(); @@ -404,4 +477,156 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM return 16; } + + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + if (!KeyboardUtils.isShiftKeyDown()) { + super.onScrewdriverRightClick(aSide, aPlayer, aX, aY, aZ); + } + else { + this.mIsAnimated = Utils.invertBoolean(mIsAnimated); + if (this.mIsAnimated) { + PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); + } + else { + PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); + } + if (mTurbineRotorHatches.size() > 0) { + for (GT_MetaTileEntity_Hatch_Turbine h : mTurbineRotorHatches) { + if (h != null) { + h.mUsingAnimation = mIsAnimated; + } + } + } + } + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setBoolean("mIsAnimated", mIsAnimated); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + mIsAnimated = aNBT.getBoolean("mIsAnimated"); + } + + private boolean mIsAnimated = true; + public ITexture frontFace; + public ITexture frontFaceActive; + private CustomIcon GT9_5_Active; + private CustomIcon GT9_5; + + public boolean usingAnimations() { + return mIsAnimated; + } + + @Override + public final ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[1][aColorIndex + 1], aFacing == aSide ? getFrontFacingTurbineTexture(aActive) : Textures.BlockIcons.CASING_BLOCKS[getTAE()]}; + } + + protected ITexture getFrontFacingTurbineTexture(boolean isActive) { + if (usingAnimations()) { + if (isActive) { + return frontFaceActive; + } + } + return frontFace; + } + + public boolean addTurbineHatch(final IGregTechTileEntity aTileEntity, + final int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } + final IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) { + return false; + } + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Turbine) { + log("Found GT_MetaTileEntity_Hatch_Turbine"); + updateTexture(aTileEntity, aBaseCasingIndex); + GT_MetaTileEntity_Hatch_Turbine aTurbineHatch = (GT_MetaTileEntity_Hatch_Turbine) aMetaTileEntity; + IGregTechTileEntity g = this.getBaseMetaTileEntity(); + if (aTurbineHatch.setController(new BlockPos(g.getXCoord(), g.getYCoord(), g.getZCoord(), g.getWorld()))) { + Logger.INFO("Injected Controller into Turbine Assembly."); + return this.mTurbineRotorHatches.add(aTurbineHatch); + } + else { + Logger.INFO("Failed to inject controller into Turbine Assembly Hatch."); + } + } + return false; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (aBaseMetaTileEntity.isServerSide()) { + if (mUpdate == 0 || this.mStartUpCheck == 0) { + this.mTurbineRotorHatches.clear(); + } + } + if (aTick % 20 == 0 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled()) { + enableAllTurbineHatches(); + } + + } + @Override + public void startProcess() { + super.startProcess(); + enableAllTurbineHatches(); + } + @Override + public void onMachineBlockUpdate() { + super.onMachineBlockUpdate(); + } + @Override + public boolean onRunningTick(ItemStack aStack) { + return super.onRunningTick(aStack); + } + @Override + public void stopMachine() { + super.stopMachine(); + disableAllTurbineHatches(); + } + @Override + public void onRemoval() { + super.onRemoval(); + for (GT_MetaTileEntity_Hatch_Turbine h : this.mTurbineRotorHatches) { + h.clearController(); + } + disableAllTurbineHatches(); + this.mTurbineRotorHatches.clear(); + } + + public boolean enableAllTurbineHatches() { + return updateTurbineHatches(this.isMachineRunning()) > 0; + } + public boolean disableAllTurbineHatches() { + return updateTurbineHatches(false) > 0; + } + + private Long mLastHatchUpdate; + public int updateTurbineHatches(boolean aState) { + int aUpdated = 0; + if (mLastHatchUpdate == null) { + mLastHatchUpdate = System.currentTimeMillis()/1000; + } + if (this.mTurbineRotorHatches.isEmpty() || ((System.currentTimeMillis()/1000)-mLastHatchUpdate) <= 2) { + return 0; + } + for (GT_MetaTileEntity_Hatch_Turbine h : this.mTurbineRotorHatches) { + h.setActive(aState); + aUpdated++; + } + + mLastHatchUpdate = System.currentTimeMillis()/1000; + return aUpdated; + } + + } |