diff options
Diffstat (limited to 'src/Java')
7 files changed, 390 insertions, 395 deletions
diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index a869f54288..c43fa3c9c0 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -119,6 +119,7 @@ public class COMPAT_HANDLER { GregtechNaqReactor.run(); GregtechIndustrialArcFurnace.run(); GregtechSolarTower.run(); + GregtechLargeTurbinesAndHeatExchanger.run(); //New Horizons Content NewHorizonsAccelerator.run(); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 2f19d2933b..feb2ea275d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -281,6 +281,10 @@ public enum GregtechItemList implements GregtechItemContainer { Casing_SolarTower_Structural, Casing_SolarTower_SaltContainment, Casing_SolarTower_HeatContainment, + + //Larger Turbines + Large_Steam_Turbine, Large_HPSteam_Turbine, + Casing_Turbine_Shaft, Casing_Turbine_LP, Casing_Turbine_HP, @@ -510,7 +514,7 @@ public enum GregtechItemList implements GregtechItemContainer { */ //Fluid Void Covers - Cover_Overflow_ULV, Cover_Overflow_LV, Cover_Overflow_MV, Cover_Overflow_HV, Cover_Overflow_EV, Cover_Overflow_IV, + Cover_Overflow_ULV, Cover_Overflow_LV, Cover_Overflow_MV, Cover_Overflow_HV, Cover_Overflow_EV, Cover_Overflow_IV, diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java index c530c6c360..f47e1d5b72 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/GregtechMetaCasingBlocks4.java @@ -28,9 +28,9 @@ extends GregtechMetaCasingBlocksAbstract { GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".4.name", "Structural Solar Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".5.name", "Salt Containment Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".6.name", "Thermal Containment Casing"); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", ""); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", ""); - GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", ""); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".7.name", "Turbine Shaft"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".8.name", "Low Pressure Turbine Casing"); + GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".9.name", "High Pressure Turbine Casing"); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".10.name", ""); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".11.name", ""); GT_LanguageManager.addStringLocalization(this.getUnlocalizedName() + ".12.name", ""); @@ -44,10 +44,10 @@ extends GregtechMetaCasingBlocksAbstract { GregtechItemList.Casing_SolarTower_Structural.set(new ItemStack(this, 1, 4)); GregtechItemList.Casing_SolarTower_SaltContainment.set(new ItemStack(this, 1, 5)); GregtechItemList.Casing_SolarTower_HeatContainment.set(new ItemStack(this, 1, 6)); - /*GregtechItemList.Casing_Vanadium_Redox.set(new ItemStack(this, 1, 7)); - GregtechItemList.Casing_Power_SubStation.set(new ItemStack(this, 1, 8)); - GregtechItemList.Casing_Cyclotron_Coil.set(new ItemStack(this, 1, 9)); - GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10)); + GregtechItemList.Casing_Turbine_Shaft.set(new ItemStack(this, 1, 7)); + GregtechItemList.Casing_Turbine_LP.set(new ItemStack(this, 1, 8)); + GregtechItemList.Casing_Turbine_HP.set(new ItemStack(this, 1, 9)); + /*GregtechItemList.Casing_Cyclotron_External.set(new ItemStack(this, 1, 10)); GregtechItemList.Casing_ThermalContainment.set(new ItemStack(this, 1, 11)); GregtechItemList.Casing_Autocrafter.set(new ItemStack(this, 1, 12)); GregtechItemList.Casing_CuttingFactoryFrame.set(new ItemStack(this, 1, 13)); 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 3512b4eb67..e57fbed1f8 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 @@ -11,7 +11,9 @@ 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; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -33,10 +35,13 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu @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[59]}; + 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); + } return new String[]{ "Controller Block for the XL High Pressure Steam Turbine", "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)", @@ -44,7 +49,7 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu "1x Maintenance Hatch (Side centered)", "1x Dynamo Hatch (Back centered)", "1x Output Hatch for Steam (Side centered)", - "Titanium Turbine Casings for the rest (24 at least!)", + mCasingName+"s for the rest (24 at least!)", "Needs a Turbine Item (Inside controller GUI)", "Output depending on Rotor and fitting", "Use screwdriver to adjust fitting of turbine"}; @@ -62,7 +67,7 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu @Override public byte getCasingMeta() { - return 11; + return 9; } @Override @@ -142,8 +147,6 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu public int getDamageToComponent(ItemStack aStack) { return (looseFit && CORE.RANDOM.nextInt(4)==0)?0:1; } - - @Override public String[] getExtraInfoData() { @@ -177,4 +180,5 @@ public class GT_MTE_LargeTurbine_SHSteam extends GregtechMetaTileEntity_LargerTu public String getMachineType() { return "Large Super-heated Steam Turbine"; } + } 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 22246dd17c..27b5f9a774 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 @@ -6,6 +6,7 @@ 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; @@ -13,7 +14,8 @@ 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.lib.CORE; +import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -37,10 +39,13 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb @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[57]}; + 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); + } return new String[]{ "Controller Block for the XL Steam Turbine", "Size(WxHxD): 3x3x4 (Hollow), Controller (Front centered)", @@ -48,7 +53,7 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb "1x Maintenance Hatch (Side centered)", "1x Dynamo Hatch (Back centered)", "1x Output Hatch for Distilled Water (Side centered)", - "Turbine Casings for the rest (24 at least!)", + mCasingName+"s for the rest (24 at least!)", "Needs a Turbine Item (Inside controller GUI)", "Output depending on Rotor and fitting", "Use screwdriver to adjust fitting of turbine"}; @@ -66,7 +71,7 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb @Override public byte getCasingMeta() { - return 9; + return 8; } @Override @@ -171,7 +176,6 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb looseFit=aNBT.getBoolean("turbineFitting"); } - @Override public boolean hasSlotInGUI() { return true; @@ -183,9 +187,9 @@ public class GT_MTE_LargeTurbine_Steam extends GregtechMetaTileEntity_LargerTurb return null; } - @Override public String getMachineType() { return "Large Steam Turbine"; } + } 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 e33e8a699f..ea27472236 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 @@ -2,6 +2,8 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.t import java.util.ArrayList; +import gregtech.api.GregTech_API; +import gregtech.api.enums.TAE; import gregtech.api.gui.GT_GUIContainer_MultiMachine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.items.GT_MetaGenerated_Tool; @@ -12,6 +14,7 @@ import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase; import net.minecraft.block.Block; import net.minecraft.entity.player.InventoryPlayer; @@ -23,194 +26,126 @@ import net.minecraftforge.fluids.FluidStack; public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechMeta_MultiBlockBase { - protected int baseEff = 0; - protected int optFlow = 0; - protected double realOptFlow = 0; - protected int storedFluid = 0; - protected int counter = 0; - protected boolean looseFit=false; - + protected int baseEff = 0; + protected int optFlow = 0; + protected double realOptFlow = 0; + protected int storedFluid = 0; + protected int counter = 0; + protected boolean looseFit=false; + private final int mCasingTextureID; - public static String mCasingName = "Tempered Arc Furnace Casing"; - - public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional, int mTAE) { - super(aID, aName, aNameRegional); - mCasingTextureID = mTAE; - } - public GregtechMetaTileEntity_LargerTurbineBase(String aName, int mTAE) { - super(aName); - mCasingTextureID = mTAE; - } - - public abstract int getTAE(); - - @Override - public boolean isCorrectMachinePart(ItemStack aStack) { - return getMaxEfficiency(aStack) > 0; - } - - public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png"); - } - - @Override - public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {/* - byte tSide = getBaseMetaTileEntity().getBackFacing(); - if ((getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 1)) && (getBaseMetaTileEntity().getAirAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 2))) { - int tAirCount = 0; - for (byte i = -1; i < 2; i = (byte) (i + 1)) { - for (byte j = -1; j < 2; j = (byte) (j + 1)) { - for (byte k = -1; k < 2; k = (byte) (k + 1)) { - if (getBaseMetaTileEntity().getAirOffset(i, j, k)) { - tAirCount++; - } - } - } - } - if (tAirCount != 10) { - return false; - } - for (byte i = 2; i < 6; i = (byte) (i + 1)) { - IGregTechTileEntity tTileEntity; - if ((null != (tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(i, 2))) && - (tTileEntity.getFrontFacing() == getBaseMetaTileEntity().getFrontFacing()) && (tTileEntity.getMetaTileEntity() != null) && - ((tTileEntity.getMetaTileEntity() instanceof GregtechMetaTileEntity_LargerTurbineBase))) { - return false; - } - } - int tX = getBaseMetaTileEntity().getXCoord(); - int tY = getBaseMetaTileEntity().getYCoord(); - int tZ = getBaseMetaTileEntity().getZCoord(); - for (byte i = -1; i < 2; i = (byte) (i + 1)) { - for (byte j = -1; j < 2; j = (byte) (j + 1)) { - if ((i != 0) || (j != 0)) { - for (byte k = 0; k < 4; k = (byte) (k + 1)) { - if (((i == 0) || (j == 0)) && ((k == 1) || (k == 2))) { - if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)), TAE.getIndexFromPage(3, 6))) { - return false; - } - } else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingBlock() && getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide == 4 ? -k : i), tY + j, tZ + (tSide == 2 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) { - } else { - return false; - } - } - } - } - } - this.mDynamoHatches.clear(); - IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance(getBaseMetaTileEntity().getBackFacing(), 3); - if ((tTileEntity != null) && (tTileEntity.getMetaTileEntity() != null)) { - if ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Hatch_Dynamo)) { - this.mDynamoHatches.add((GT_MetaTileEntity_Hatch_Dynamo) tTileEntity.getMetaTileEntity()); - ((GT_MetaTileEntity_Hatch) tTileEntity.getMetaTileEntity()).updateTexture(getCasingTextureIndex()); - } else { - return false; - } - } else { - return false; - } - } else { - return false; - } - return true; - */ - - return checkMachine2(aBaseMetaTileEntity, aStack); - - } - - - public boolean checkMachine2(final IGregTechTileEntity aBaseMetaTileEntity, final ItemStack aStack) { - int x = 1; - int z = 1; + public static String mCasingName; + + public GregtechMetaTileEntity_LargerTurbineBase(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta()); + mCasingTextureID = getTAE(); + } + public GregtechMetaTileEntity_LargerTurbineBase(String aName) { + super(aName); + mCasingName = ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta()); + mCasingTextureID = getTAE(); + } + + public final int getTAE() { + return TAE.getIndexFromPage(3, getCasingMeta()); + } + + public final String getCasingNaming() { + return ItemUtils.getLocalizedNameOfBlock(ModBlocks.blockCasings4Misc, getCasingMeta()); + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return getMaxEfficiency(aStack) > 0; + } + + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeTurbine.png"); + } + + @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 - - //Get Height - for (int i=0;i<=9;i++) { - Block tBlock = aBaseMetaTileEntity.getBlockOffset(i, 0, 0); - int tMeta = aBaseMetaTileEntity.getMetaIDOffset(i, 0, 0); - if (isValidCasingBlock(tBlock, tMeta)) { - depth--; - } - else { - break; - } - } - - this.mDynamoHatches.clear(); - for (int i=0;i>=depth;i--) { + //7x7 + this.mDynamoHatches.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) { + if (mMaintenanceHatches.size() != 1 || mDynamoHatches.size() < 1 || mMufflerHatches.size() < 4) { Logger.INFO("Bad Hatches"); return false; } - Logger.INFO("Built Structure"); return true; } - - - public boolean getLayer(int aY) { - if (aY == 0 || aY == 2 || aY == 3 || aY == 5 || aY == 6 || aY == 8) { - return checkNormalLayer(aY); - } - else { - return checkTurbineLayer(aY); - } - } - - public boolean checkNormalLayer(int aY) { + + + public boolean getLayer(int aY) { + if (aY == 0 || aY == 2 || aY == 3 || aY == 5 || aY == 6 || aY == 8) { + return checkNormalLayer(aY); + } + else { + return checkTurbineLayer(aY); + } + } + + public boolean checkNormalLayer(int aY) { Block tBlock; int tMeta; - for (int x = -3; x <= 3; x++) { - for (int z = -3; z <= 3; z++) { - tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - if (isValidCasingBlock(tBlock, tMeta)) { - continue; - } - else { - - if (x == 0 || z == 0) { - IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); - if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) { - continue; - } - else { - return false; - } - } - return false; - } - } - } - return true; - } - - - public boolean checkTurbineLayer(int aY) { - if (!checkTurbineLayerX(aY)) { - return checkTurbineLayerZ(aY); - } - else { - return true; - } - } - - public boolean checkTurbineLayerX(int aY) { + for (int x = -3; x <= 3; x++) { + 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); + + 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"); + continue; + } else { + Logger.INFO("BAD 1"); + return false; + } + } + } + return true; + } + + + public boolean checkTurbineLayer(int aY) { + if (!checkTurbineLayerX(aY)) { + return checkTurbineLayerZ(aY); + } + else { + return true; + } + } + + public boolean checkTurbineLayerX(int aY) { Block tBlock; int tMeta; - for (int x = -3; x <= 3; x++) { - for (int z = -3; z <= 3; z++) { - tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); + for (int x = -3; x <= 3; x++) { + for (int z = -3; z <= 3; z++) { + tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); + tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); if (x == 0 || z == 0) { IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); @@ -218,72 +153,75 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM continue; } } - - if (x == -2 || x == 2) { - if (isValidTurbineBlock(tBlock, tMeta)) { - continue; - } - else { - return false; - } - } - else { - if (isValidCasingBlock(tBlock, tMeta)) { - continue; - } - else { - return false; - } - } - } - } - return true; - } - - public boolean checkTurbineLayerZ(int aY) { + + if (x == -2 || x == 2) { + if (isValidTurbineBlock(tBlock, tMeta)) { + continue; + } + else { + return false; + } + } + else { + if (isValidCasingBlock(tBlock, tMeta)) { + continue; + } + else { + return false; + } + } + } + } + return true; + } + + public boolean checkTurbineLayerZ(int aY) { Block tBlock; int tMeta; - for (int x = -3; x <= 3; x++) { - for (int z = -3; z <= 3; z++) { - tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); - tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); - - if (x == 0 || z == 0) { + for (int x = -3; x <= 3; x++) { + for (int z = -3; z <= 3; z++) { + tBlock = this.getBaseMetaTileEntity().getBlockOffset(x, aY, z); + tMeta = this.getBaseMetaTileEntity().getMetaIDOffset(x, aY, z); + + if (x == 0 || z == 0) { IGregTechTileEntity tTileEntity = this.getBaseMetaTileEntity().getIGregTechTileEntityOffset(x, aY, z); if (this.addToMachineList(tTileEntity, this.mCasingTextureID)) { continue; } } - - if (z == -2 || z == 2) { - if (isValidTurbineBlock(tBlock, tMeta)) { - continue; - } - else { - return false; - } - } - else { - if (isValidCasingBlock(tBlock, tMeta)) { - continue; - } - else { - return false; - } - } - } - } - return true; - } + + if (z == -2 || z == 2) { + if (isValidTurbineBlock(tBlock, tMeta)) { + continue; + } + else { + return false; + } + } + else { + if (isValidCasingBlock(tBlock, tMeta)) { + continue; + } + else { + return false; + } + } + } + } + return true; + } public boolean isValidCasingBlock(Block aBlock, int aMeta) { - if (aBlock == getCasingBlock() && aMeta == getCasingMeta()) { + if (GregTech_API.sBlockMachines == aBlock) { return true; } - Logger.INFO("Found "+(aBlock != null ? aBlock.getLocalizedName() : "Air") + "With Meta "+aMeta); + 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()); return false; } - + public boolean isValidTurbineBlock(Block aBlock, int aMeta) { if (aBlock == getCasingBlock() && aMeta == getCasingMetaTurbine()) { return true; @@ -292,157 +230,178 @@ public abstract class GregtechMetaTileEntity_LargerTurbineBase extends GregtechM return false; } - public Block getCasingBlock() { - return ModBlocks.blockCasings4Misc; - } - - public abstract byte getCasingMeta(); - - public byte getCasingMetaTurbine() { - return 7; - } - - 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(); - return false; - } - ArrayList<FluidStack> tFluids = getStoredFluids(); - if (tFluids.size() > 0) { - if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() - || this.getBaseMetaTileEntity().hasInventoryBeenModified()) { - counter = 0; - 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 - * 50)); - if(optFlow<=0 || baseEff<=0){ - stopMachine();//in case the turbine got removed - return false; - } - } else { - counter++; - } - } - - 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 - - // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick) - // This is how much the turbine can actually change during this tick - int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long)Math.abs(difference)/100)); - - 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 - this.mEUt = newPower; - - if (this.mEUt <= 0) { - //stopMachine(); - this.mEUt=0; - this.mEfficiency=0; - return false; - } else { - this.mMaxProgresstime = 1; - this.mEfficiencyIncrease = 10; - if(this.mDynamoHatches.size()>0){ - for(GT_MetaTileEntity_Hatch dynamo:mDynamoHatches) - if(isValidMetaTileEntity(dynamo) && dynamo.maxEUOutput() < mEUt) - explodeMultiblock(); - } - return true; - } - } - - abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff); - - @Override - public int getDamageToComponent(ItemStack aStack) { - return 1; - } - - public int getMaxEfficiency(ItemStack aStack) { - if (GT_Utility.isStackInvalid(aStack)) { - return 0; - } - if (aStack.getItem() instanceof GT_MetaGenerated_Tool_01) { - return 10000; - } - return 0; - } - @Override - public boolean explodesOnComponentBreak(ItemStack aStack) { - return true; - } - - @Override - public String[] getExtraInfoData() { - int mPollutionReduction=0; - for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { - if (isValidMetaTileEntity(tHatch)) { - mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); - } - } - - String tRunning = mMaxProgresstime>0 ? - - EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET : - EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET; - String tMaintainance = getIdealStatus() == getRepairStatus() ? - EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : - EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ; - int tDura = 0; - - if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { - tDura = GT_Utility.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1)); - } - - long storedEnergy=0; - long maxEnergy=0; - for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { - if (isValidMetaTileEntity(tHatch)) { - storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); - maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); - } - } - String[] ret = new String[]{ - // 8 Lines available for information panels - tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", /* 1 */ - tMaintainance, /* 2 */ - StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%", /* 2 */ - StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ /* 3 */ - EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", - StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" + /* 4 */ - EnumChatFormatting.YELLOW+" ("+(looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")", /* 5 */ - StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L", /* 6 */ - StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"%", /* 7 */ - StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %" /* 8 */ - }; - if (!this.getClass().getName().contains("Steam")) - ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t"; - return ret; - - - } - - @Override - public boolean isGivingInformation() { - return true; - } + public Block getCasingBlock() { + return ModBlocks.blockCasings4Misc; + } + + public abstract byte getCasingMeta(); + + public byte getCasingMetaTurbine() { + return 7; + } + + 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(); + return false; + } + ArrayList<FluidStack> tFluids = getStoredFluids(); + if (tFluids.size() > 0) { + if (baseEff == 0 || optFlow == 0 || counter >= 512 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() + || this.getBaseMetaTileEntity().hasInventoryBeenModified()) { + counter = 0; + 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 + * 50)); + if(optFlow<=0 || baseEff<=0){ + stopMachine();//in case the turbine got removed + return false; + } + } else { + counter++; + } + } + + 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 + + // Magic numbers: can always change by at least 10 eu/t, but otherwise by at most 1 percent of the difference in power level (per tick) + // This is how much the turbine can actually change during this tick + int maxChangeAllowed = Math.max(10, GT_Utility.safeInt((long)Math.abs(difference)/100)); + + 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 + this.mEUt = newPower; + + if (this.mEUt <= 0) { + //stopMachine(); + this.mEUt=0; + this.mEfficiency=0; + return false; + } else { + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = 10; + if(this.mDynamoHatches.size()>0){ + for(GT_MetaTileEntity_Hatch dynamo:mDynamoHatches) + if(isValidMetaTileEntity(dynamo) && dynamo.maxEUOutput() < mEUt) + explodeMultiblock(); + } + return true; + } + } + + abstract int fluidIntoPower(ArrayList<FluidStack> aFluids, int aOptFlow, int aBaseEff); + + @Override + public int getDamageToComponent(ItemStack aStack) { + return 1; + } + + public int getMaxEfficiency(ItemStack aStack) { + if (GT_Utility.isStackInvalid(aStack)) { + return 0; + } + if (aStack.getItem() instanceof GT_MetaGenerated_Tool_01) { + return 10000; + } + return 0; + } + @Override + public boolean explodesOnComponentBreak(ItemStack aStack) { + return true; + } + + @Override + public String[] getExtraInfoData() { + int mPollutionReduction=0; + for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + mPollutionReduction=Math.max(tHatch.calculatePollutionReduction(100),mPollutionReduction); + } + } + + String tRunning = mMaxProgresstime>0 ? + + EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.running.true")+EnumChatFormatting.RESET : + EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.running.false")+EnumChatFormatting.RESET; + String tMaintainance = getIdealStatus() == getRepairStatus() ? + EnumChatFormatting.GREEN+StatCollector.translateToLocal("GT5U.turbine.maintenance.false")+EnumChatFormatting.RESET : + EnumChatFormatting.RED+StatCollector.translateToLocal("GT5U.turbine.maintenance.true")+EnumChatFormatting.RESET ; + int tDura = 0; + + if (mInventory[1] != null && mInventory[1].getItem() instanceof GT_MetaGenerated_Tool_01) { + tDura = GT_Utility.safeInt((long)(100.0f / GT_MetaGenerated_Tool.getToolMaxDamage(mInventory[1]) * (GT_MetaGenerated_Tool.getToolDamage(mInventory[1]))+1)); + } + + long storedEnergy=0; + long maxEnergy=0; + for(GT_MetaTileEntity_Hatch_Dynamo tHatch : mDynamoHatches) { + if (isValidMetaTileEntity(tHatch)) { + storedEnergy+=tHatch.getBaseMetaTileEntity().getStoredEU(); + maxEnergy+=tHatch.getBaseMetaTileEntity().getEUCapacity(); + } + } + String[] ret = new String[]{ + // 8 Lines available for information panels + tRunning + ": " + EnumChatFormatting.RED+mEUt+EnumChatFormatting.RESET+" EU/t", /* 1 */ + tMaintainance, /* 2 */ + StatCollector.translateToLocal("GT5U.turbine.efficiency")+": "+EnumChatFormatting.YELLOW+(mEfficiency/100F)+EnumChatFormatting.RESET+"%", /* 2 */ + StatCollector.translateToLocal("GT5U.multiblock.energy")+": " + EnumChatFormatting.GREEN + Long.toString(storedEnergy) + EnumChatFormatting.RESET +" EU / "+ /* 3 */ + EnumChatFormatting.YELLOW + Long.toString(maxEnergy) + EnumChatFormatting.RESET +" EU", + StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t" + /* 4 */ + EnumChatFormatting.YELLOW+" ("+(looseFit?StatCollector.translateToLocal("GT5U.turbine.loose"):StatCollector.translateToLocal("GT5U.turbine.tight"))+")", /* 5 */ + StatCollector.translateToLocal("GT5U.turbine.fuel")+": "+EnumChatFormatting.GOLD+storedFluid+EnumChatFormatting.RESET+"L", /* 6 */ + StatCollector.translateToLocal("GT5U.turbine.dmg")+": "+EnumChatFormatting.RED+Integer.toString(tDura)+EnumChatFormatting.RESET+"%", /* 7 */ + StatCollector.translateToLocal("GT5U.multiblock.pollution")+": "+ EnumChatFormatting.GREEN + mPollutionReduction+ EnumChatFormatting.RESET+" %" /* 8 */ + }; + if (!this.getClass().getName().contains("Steam")) + ret[4]=StatCollector.translateToLocal("GT5U.turbine.flow")+": "+EnumChatFormatting.YELLOW+GT_Utility.safeInt((long)realOptFlow)+EnumChatFormatting.RESET+" L/t"; + return ret; + + + } + + @Override + public boolean isGivingInformation() { + return true; + } + + + public boolean polluteEnvironment(int aPollutionLevel) { + mPollution += aPollutionLevel; + for (GT_MetaTileEntity_Hatch_Muffler tHatch : mMufflerHatches) { + if (isValidMetaTileEntity(tHatch)) { + if (mPollution >= 1000) { + if (tHatch.polluteEnvironment()) { + mPollution -= 1000; + } + } else { + break; + } + } + } + return mPollution < 1000; + } + @Override + public long maxAmperesOut() { + return 16; + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLargeTurbinesAndHeatExchanger.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLargeTurbinesAndHeatExchanger.java new file mode 100644 index 0000000000..6f2e5c2e11 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechLargeTurbinesAndHeatExchanger.java @@ -0,0 +1,23 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_SHSteam; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.GT_MTE_LargeTurbine_Steam; + +public class GregtechLargeTurbinesAndHeatExchanger { + + public static void run() { + if (gtPlusPlus.core.lib.LoadedMods.Gregtech) { + Logger.INFO("Gregtech5u Content | Registering Larger Turbines & Extra Large Heat Exchanger."); + run1(); + } + + } + + private static void run1() { + GregtechItemList.Large_Steam_Turbine.set(new GT_MTE_LargeTurbine_Steam(865, "multimachine.largerturbine", "XL Turbo Steam Turbine").getStackForm(1L)); + GregtechItemList.Large_HPSteam_Turbine.set(new GT_MTE_LargeTurbine_SHSteam(866, "multimachine.largerhpturbine", "XL Turbo HP Steam Turbine").getStackForm(1L)); + + } +}
\ No newline at end of file |