diff options
author | Blood-Asp <Blood@Asp> | 2015-05-25 23:04:14 +0200 |
---|---|---|
committer | Blood-Asp <Blood@Asp> | 2015-05-25 23:04:14 +0200 |
commit | adb4a5eef6c1abf5f2ce68d133d7f54c16939442 (patch) | |
tree | a9304e34720072cbcf3a59764599f85d50ce6712 /main/java/gregtech/common/tileentities/machines/multi | |
parent | a102e63891d2af3452dc9b25d9fd97bc266582b7 (diff) | |
download | GT5-Unofficial-adb4a5eef6c1abf5f2ce68d133d7f54c16939442.tar.gz GT5-Unofficial-adb4a5eef6c1abf5f2ce68d133d7f54c16939442.tar.bz2 GT5-Unofficial-adb4a5eef6c1abf5f2ce68d133d7f54c16939442.zip |
Update 5.08.17
Large Turbines, Heat exchanger, player detector
Diffstat (limited to 'main/java/gregtech/common/tileentities/machines/multi')
8 files changed, 647 insertions, 59 deletions
diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java index 975089e607..aedeeac45d 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_FusionComputer.java @@ -3,6 +3,7 @@ /* 3: */ import java.util.ArrayList; import java.util.Arrays; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Dyes; import gregtech.api.enums.Textures; @@ -362,6 +363,8 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { mProgresstime = 0; mMaxProgresstime = 0; mEfficiencyIncrease = 0; + if(mOutputFluids!=null&&mOutputFluids.length>0){ + GT_Mod.instance.achievements.issueAchivementHatchFluid(aBaseMetaTileEntity.getWorld().getPlayerEntityByName(aBaseMetaTileEntity.getOwnerName()), mOutputFluids[0]);} this.mEUStore=(int) aBaseMetaTileEntity.getStoredEU(); if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); } diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java new file mode 100644 index 0000000000..c8bd25d6c6 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_HeatExchanger.java @@ -0,0 +1,257 @@ +package gregtech.common.tileentities.machines.multi; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.Fluid; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import forestry.core.fluids.Fluids; +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; + +public class GT_MetaTileEntity_HeatExchanger extends GT_MetaTileEntity_MultiBlockBase{ + /* 25: */ public GT_MetaTileEntity_HeatExchanger(int aID, String aName, String aNameRegional) + /* 26: */ { + /* 27: 25 */ super(aID, aName, aNameRegional); + /* 28: */ } + /* 29: */ + /* 30: */ public GT_MetaTileEntity_HeatExchanger(String aName) + /* 31: */ { + /* 32: 29 */ super(aName); + /* 33: */ } + /* 34: */ + /* 35: */ public String[] getDescription() + /* 36: */ { + /* 37: 34 */ return new String[] { "Controller Block for the Heat Exchanger", "Size: 3x3x4", "Controller (front middle at bottom)", "3x3x4 of Stable Titanium Casing (hollow, Min 24!)", "2 Titanium Pipe Casing Blocks inside the Hollow Casing", "1x Distillated Water Input (one of the Casings)","min 1 Steam Output (one of the Casings)", "1x Maintenance Hatch (one of the Casings)", "1x Hot Fluid Input (botton Center)", "1x Cold Fluid Output (top Center)" }; + /* 38: */ } + + public GT_MetaTileEntity_Hatch_Input mInputHotFluidHatch; + public GT_MetaTileEntity_Hatch_Output mOutputColdFluidHatch; + public boolean superheated=false; + /* 59: */ + /* 60: */ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) + /* 61: */ { + /* 62: 53 */ if (aSide == aFacing) { + /* 63: 53 */ return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[50], new GT_RenderedTexture(aActive ? Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER_ACTIVE : Textures.BlockIcons.OVERLAY_FRONT_LARGE_BOILER) }; + /* 64: */ } + /* 65: 54 */ return new ITexture[] { Textures.BlockIcons.CASING_BLOCKS[50] }; + /* 66: */ } + /* 67: */ + /* 68: */ public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) + /* 69: */ { + /* 70: 59 */ return new GT_GUIContainer_MultiMachine(aPlayerInventory, aBaseMetaTileEntity, getLocalName(), "LargeBoiler.png"); + /* 71: */ } + /* 72: */ + /* 73: */ public boolean isCorrectMachinePart(ItemStack aStack) + /* 74: */ { + /* 75: 64 */ return true; + /* 76: */ } + /* 77: */ + /* 78: */ public boolean isFacingValid(byte aFacing) + /* 79: */ { + /* 80: 67 */ return aFacing > 1; + /* 81: */ } + /* 82: */ + /* 83: */ public boolean checkRecipe(ItemStack aStack) + /* 84: */ { + if(GT_ModHandler.isLava(mInputHotFluidHatch.getFluid())){ + int fluidAmount = mInputHotFluidHatch.getFluidAmount(); + if(fluidAmount >= 1000){superheated=true;}else{superheated=false;} + if(fluidAmount>2000){fluidAmount=2000;} + mInputHotFluidHatch.drain(fluidAmount, true); + mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2pahoehoelava", fluidAmount), true); + + + this.mMaxProgresstime = 20; + this.mEUt = fluidAmount*2; + this.mEfficiencyIncrease = 80; + return true; + } + + if(mInputHotFluidHatch.getFluid().isFluidEqual(FluidRegistry.getFluidStack("ic2hotcoolant", 1))){ + int fluidAmount = mInputHotFluidHatch.getFluidAmount(); + if(fluidAmount >= 4000){superheated=true;}else{superheated=false;} + if(fluidAmount>8000){fluidAmount=8000;} + mInputHotFluidHatch.drain(fluidAmount, true); + mOutputColdFluidHatch.fill(FluidRegistry.getFluidStack("ic2coolant", fluidAmount), true); + + + this.mMaxProgresstime = 20; + this.mEUt = fluidAmount/2; + this.mEfficiencyIncrease = 20; + return true; + } + return false;} + /* 133: */ + /* 134: */ public boolean onRunningTick(ItemStack aStack) + /* 135: */ { + /* 136:115 */ if (this.mEUt > 0) + /* 137: */ {System.out.println("EU: "+mEUt+" Eff: "+mEfficiency); + /* 138:116 */ int tGeneratedEU = (int)(this.mEUt * 2L * this.mEfficiency / 10000L); + /* 139:117 */ if (tGeneratedEU > 0) { + /* 140:118 */ if (depleteInput(GT_ModHandler.getDistilledWater(((superheated ? tGeneratedEU/2 :tGeneratedEU) + 160) / 160))) { + if(superheated){ + addOutput(FluidRegistry.getFluidStack("ic2superheatedsteam", tGeneratedEU/2)); + }else{ + /* 141:119 */ addOutput(GT_ModHandler.getSteam(tGeneratedEU));} + /* 142: */ } else { + /* 143:121 */ explodeMultiblock(); + /* 144: */ } + /* 145: */ } + /* 146:124 */ return true; + /* 147: */ } + /* 148:126 */ return true; + /* 149: */ } + /* 150: */ private static boolean controller; + /* 151: */ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) + /* 152: */ { + /* 153:131 */ int xDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetX;int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ; + /* 154: */ + /* 155:133 */ int tCasingAmount = 0;int tFireboxAmount = 0;controller=false; + /* 156:135 */ for (int i = -1; i < 2; i++) { + /* 157:135 */ for (int j = -1; j < 2; j++) { + /* 158:136 */ if ((i != 0) || (j != 0)) + /* 159: */ { + /* 160:137 */ for (int k = 0; k <= 3; k++) { + /* 161:138 */ if (!addOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), 50)&&!addInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), 50)&&!addMaintenanceToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, k, zDir + j), 50)&&!ignoreController(aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j))) + /* 162: */ { + /* 163:139 */ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, k, zDir + j) != getCasingBlock()) { + /* 164:139 */ return false; + /* 165: */ } + /* 166:140 */ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, k, zDir + j) != getCasingMeta()) { + /* 167:140 */ return false; + /* 168: */ } + /* 169:141 */ tCasingAmount++; + /* 170: */ } + } + /* 171: */ }else{ + if(!addHotFluidInputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 0, zDir + j), 50)){ + return false; + } + if(!addColdFluidOutputToMachineList(aBaseMetaTileEntity.getIGregTechTileEntityOffset(xDir + i, 3, zDir + j), 50)){ + return false; + } + /* 177:146 */ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 1, zDir + j) != getPipeBlock()) { + /* 178:146 */ return false; + /* 179: */ } + /* 180:147 */ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 1, zDir + j) != getPipeMeta()) { + /* 181:147 */ return false; + /* 182: */ } + + /* 177:146 */ if (aBaseMetaTileEntity.getBlockOffset(xDir + i, 2, zDir + j) != getPipeBlock()) { + /* 178:146 */ return false; + /* 179: */ } + /* 180:147 */ if (aBaseMetaTileEntity.getMetaIDOffset(xDir + i, 2, zDir + j) != getPipeMeta()) { + /* 181:147 */ return false; + /* 182: */ } + /* 172: */ } + /* 195: */ } + /* 196: */ } + /* 215:166 */ return (tCasingAmount >= 24); + /* 216: */ } + + public boolean ignoreController(Block tTileEntity){ + if(!controller&&tTileEntity == GregTech_API.sBlockMachines){return true;} + return false; + } + + public boolean addColdFluidOutputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Output) { + ((GT_MetaTileEntity_Hatch)aMetaTileEntity).mMachineBlock = (byte)aBaseCasingIndex; + mOutputColdFluidHatch = (GT_MetaTileEntity_Hatch_Output)aMetaTileEntity; + return true; + } + return false; + } + + public boolean addHotFluidInputToMachineList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) return false; + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity == null) return false; + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Input) { + ((GT_MetaTileEntity_Hatch)aMetaTileEntity).mMachineBlock = (byte)aBaseCasingIndex; + ((GT_MetaTileEntity_Hatch_Input)aMetaTileEntity).mRecipeMap = getRecipeMap(); + mInputHotFluidHatch = (GT_MetaTileEntity_Hatch_Input)aMetaTileEntity; + return true; + } + return false; + } + + /* 26: */ public Block getCasingBlock() + /* 27: */ { + /* 28:22 */ return GregTech_API.sBlockCasings4; + /* 29: */ } + /* 30: */ + /* 31: */ public byte getCasingMeta() + /* 32: */ { + /* 33:23 */ return 2; + /* 34: */ } + /* 35: */ + /* 36: */ public byte getCasingTextureIndex() + /* 37: */ { + /* 38:24 */ return 50; + /* 39: */ } + /* 40: */ + /* 41: */ public Block getPipeBlock() + /* 42: */ { + /* 43:26 */ return GregTech_API.sBlockCasings2; + /* 44: */ } + /* 45: */ + /* 46: */ public byte getPipeMeta() + /* 47: */ { + /* 48:27 */ return 14; + /* 49: */ } + /* 217: */ + /* 218: */ public int getMaxEfficiency(ItemStack aStack) + /* 219: */ { + /* 220:171 */ return 10000; + /* 221: */ } + /* 222: */ + /* 223: */ public int getPollutionPerTick(ItemStack aStack) + /* 224: */ { + /* 225:176 */ return 10; + /* 226: */ } + /* 227: */ + /* 228: */ public int getDamageToComponent(ItemStack aStack) + /* 229: */ { + /* 230:181 */ return 0; + /* 231: */ } + /* 232: */ + /* 233: */ public int getAmountOfOutputs() + /* 234: */ { + /* 235:186 */ return 1; + /* 236: */ } + /* 237: */ + /* 238: */ public boolean explodesOnComponentBreak(ItemStack aStack) + /* 239: */ { + /* 240:191 */ return false; + /* 241: */ } + /* 242: */ + /* 21: */ public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) + /* 22: */ { + /* 23:19 */ return new GT_MetaTileEntity_HeatExchanger(this.mName); + /* 24: */ } + } diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java index f3dad61817..a5c906827a 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeBoiler_Titanium.java @@ -72,10 +72,4 @@ /* 72: */ {
/* 73:34 */ return 8;
/* 74: */ }
-/* 75: */ }
-
-
-/* Location: F:\Torrent\minecraft\jd-gui-0.3.6.windows\gregtech_1.7.10-5.07.07-dev.jar
- * Qualified Name: gregtech.common.tileentities.machines.multi.GT_MetaTileEntity_LargeBoiler_Titanium
- * JD-Core Version: 0.7.0.1
- */
\ No newline at end of file +/* 75: */ }
\ No newline at end of file diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java index 1d5f18d9e5..dc9c9a7615 100644 --- a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -1,6 +1,10 @@ package gregtech.common.tileentities.machines.multi; +import java.util.ArrayList; + +import net.minecraft.block.Block; import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; import gregtech.api.GregTech_API; import gregtech.api.enums.ItemList; import gregtech.api.enums.Textures; @@ -16,57 +20,22 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Utility; import gregtech.common.items.GT_MetaGenerated_Tool_01; -public class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlockBase{ +public abstract class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlockBase{ public GT_MetaTileEntity_LargeTurbine(int aID, String aName, String aNameRegional){super(aID, aName, aNameRegional);} public GT_MetaTileEntity_LargeTurbine(String aName){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_ACTIVE5):new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; - } - - - public String[] getDescription() - { - return new String[] { - "Controller Block for the Large Turbine", - "Size: 3x3x4 (Hollow)", "Controller (front centered)", - "1x Input Hatch (side centered)", "1x Output Hatch(side centered)", - "1x Dynamo Hatch (back centered)", - "1x Maintenance Hatch (side centered)", - "Turbine Casings for the rest (24 at least!)" }; - } @Override public boolean isCorrectMachinePart(ItemStack aStack) { return getMaxEfficiency(aStack) > 0; } + protected int baseEff=0; + protected int optFlow=0; + protected int counter=0; @Override - public boolean checkRecipe(ItemStack aStack) { - if (depleteInput(GT_ModHandler.getSteam(1600L))) - { - this.mEUt = 1000; - this.mMaxProgresstime = 1; -// if (ItemList.Component_Turbine_Bronze.isStackEqual(aStack, true, true)) { -// this.mEfficiencyIncrease = (this.mMaxProgresstime * 10); -// } else if (ItemList.Component_Turbine_Steel.isStackEqual(aStack, true, true)) { -// this.mEfficiencyIncrease = (this.mMaxProgresstime * 20); -// } else if (ItemList.Component_Turbine_Magnalium.isStackEqual(aStack, true, true)) { -// this.mEfficiencyIncrease = (this.mMaxProgresstime * 50); -// } else if (ItemList.Component_Turbine_TungstenSteel.isStackEqual(aStack, true, true)) { -// this.mEfficiencyIncrease = (this.mMaxProgresstime * 15); -// } else if (ItemList.Component_Turbine_Carbon.isStackEqual(aStack, true, true)) { -// this.mEfficiencyIncrease = (this.mMaxProgresstime * 100); -// } else { - this.mEfficiencyIncrease = (this.mMaxProgresstime * 20); -// } - addOutput(GT_ModHandler.getDistilledWater(10L)); - return true; - } - return false; - } + public abstract boolean checkRecipe(ItemStack aStack); @Override public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { @@ -102,17 +71,17 @@ public class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlock 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 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == GregTech_API.sBlockCasings4) + if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == getCasingBlock()) { - if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 9) {} + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) {} } else if (!addToMachineList(getBaseMetaTileEntity().getIGregTechTileEntity(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)))) { return false; } } - else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == GregTech_API.sBlockCasings4) + else if (getBaseMetaTileEntity().getBlock(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == getCasingBlock()) { - if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 9) {} + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == getCasingMeta()) {} } else { return false; @@ -126,7 +95,7 @@ public class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlock 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()).mMachineBlock = (byte)46; + ((GT_MetaTileEntity_Hatch)tTileEntity.getMetaTileEntity()).mMachineBlock = getCasingTextureIndex(); } else { return false; } @@ -139,23 +108,28 @@ public class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlock return true; } + public abstract Block getCasingBlock(); + + public abstract byte getCasingMeta(); + + public abstract byte getCasingTextureIndex(); + private boolean addToMachineList(IGregTechTileEntity tTileEntity){ - return ((addMaintenanceToMachineList(tTileEntity, 46)) || (addInputToMachineList(tTileEntity, 46)) || (addOutputToMachineList(tTileEntity, 46))); + return ((addMaintenanceToMachineList(tTileEntity, getCasingTextureIndex())) || (addInputToMachineList(tTileEntity, getCasingTextureIndex())) || (addOutputToMachineList(tTileEntity, getCasingTextureIndex()))); } @Override public int getDamageToComponent(ItemStack aStack) { - return 1;//GT_Utility.areStacksEqual(GT_ModHandler.getModItem("Railcraft","part.turbine.rotor", 1L, 32767), aStack) ? 2 : 1; + 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 10000; } return 0; } @@ -167,7 +141,4 @@ public class GT_MetaTileEntity_LargeTurbine extends GT_MetaTileEntity_MultiBlock public int getAmountOfOutputs() {return 0;} @Override public boolean explodesOnComponentBreak(ItemStack aStack) {return true;} - @Override - public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {return new GT_MetaTileEntity_LargeTurbine(mName);} - } diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java new file mode 100644 index 0000000000..abf8458a6e --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Gas.java @@ -0,0 +1,92 @@ +package gregtech.common.tileentities.machines.multi; + +import java.util.ArrayList; +import java.util.Collection; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +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.items.GT_MetaGenerated_Tool; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.api.util.GT_Utility; + +public class GT_MetaTileEntity_LargeTurbine_Gas extends GT_MetaTileEntity_LargeTurbine{ + + public GT_MetaTileEntity_LargeTurbine_Gas(int aID, String aName, String aNameRegional){super(aID, aName, aNameRegional);} + public GT_MetaTileEntity_LargeTurbine_Gas(String aName){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_ACTIVE5):new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + + public String[] getDescription() + { + return new String[] { + "Controller Block for the Large Gas Turbine", + "Size: 3x3x4 (Hollow)", "Controller (front centered)", + "1x Input Hatch (side centered)", + "1x Dynamo Hatch (back centered)", + "1x Maintenance Hatch (side centered)", + "Turbine Casings for the rest (24 at least!)", + "Needs a Turbine Item (inside controller GUI)"}; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> steams = getStoredFluids(); + if (steams.size()>0) + {if(baseEff==0 || optFlow == 0 || counter >= 1000 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()){ + counter = 0; + baseEff = (int) ((50.0F+(10.0F*((GT_MetaGenerated_Tool)aStack.getItem()).getToolCombatDamage(aStack)))*100); + optFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool)aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() * ((GT_MetaGenerated_Tool)aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed*50); + } + int tEU=0; + for(int i=0;i<steams.size();i++){ + int fuelValue = getFuelValue(steams.get(i)); + if(fuelValue>0&&depleteInput(new FluidStack(steams.get(i),optFlow/(fuelValue*2)))){ + tEU += optFlow/2;} + } + this.mEUt = baseEff*tEU/10000; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = (this.mMaxProgresstime * 10); + if(mEUt==0){return false;} + return true; + } + return false; + } + + public int getFuelValue(FluidStack aLiquid) { + if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0; + FluidStack tLiquid; + Collection<GT_Recipe> tRecipeList = GT_Recipe_Map.sTurbineFuels.mRecipeList; + if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue; + return 0; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {return new GT_MetaTileEntity_LargeTurbine_Gas(mName);} + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + @Override + public byte getCasingMeta() { + return 9; + } + @Override + public byte getCasingTextureIndex() { + return 46; + } + + +} diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java new file mode 100644 index 0000000000..c85e79f594 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_HPSteam.java @@ -0,0 +1,89 @@ +package gregtech.common.tileentities.machines.multi; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +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.items.GT_MetaGenerated_Tool; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; + +public class GT_MetaTileEntity_LargeTurbine_HPSteam extends GT_MetaTileEntity_LargeTurbine{ + + public GT_MetaTileEntity_LargeTurbine_HPSteam(int aID, String aName, String aNameRegional){super(aID, aName, aNameRegional);} + public GT_MetaTileEntity_LargeTurbine_HPSteam(String aName){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_ACTIVE5):new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + + public String[] getDescription() + { + return new String[] { + "Controller Block for the Large High Pressure Steam Turbine", + "Size: 3x3x4 (Hollow)", "Controller (front centered)", + "1x Input Hatch (side centered)", "1x Output Hatch(side centered)", + "1x Dynamo Hatch (back centered)", + "1x Maintenance Hatch (side centered)", + "Turbine Casings for the rest (24 at least!)", + "Needs a Turbine Item (inside controller GUI)" }; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> steams = getStoredFluids(); + if (steams.size()>0) + {if(baseEff==0 || optFlow == 0 || counter >= 1000 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()){ + counter = 0; + baseEff = (int) ((50.0F+(10.0F*((GT_MetaGenerated_Tool)aStack.getItem()).getToolCombatDamage(aStack)))*100); + optFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool)aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() * ((GT_MetaGenerated_Tool)aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed*50); + } + int tEU=0; + int distOut=0; + for(int i=0;i<steams.size();i++){ + if(steams.get(i).getFluid().getUnlocalizedName(steams.get(i)).equals("fluid.ic2superheatedsteam")){ + int out = Math.min((int)(optFlow*1.5f),steams.get(i).amount); + depleteInput(new FluidStack(steams.get(i),out)); + distOut += out; + tEU += steams.get(i).amount; + } + } + if(tEU<optFlow/10){tEU=0;} + if(tEU>optFlow) {tEU = optFlow;} + float tEff = tEU/(optFlow); + this.mEUt = (int) (tEff*tEU*baseEff/10000); + this.mMaxProgresstime = 1; +// System.out.println("Eff: "+baseEff+" optFlow: "+optFlow+" tEff: "+tEff+" eut: "+mEUt+" out: "+distOut); + this.mEfficiencyIncrease = (this.mMaxProgresstime * 10); + if(mEUt==0){return false;} + addOutput(GT_ModHandler.getSteam(distOut)); + return true; + } + return false; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {return new GT_MetaTileEntity_LargeTurbine_HPSteam(mName);} + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + @Override + public byte getCasingMeta() { + return 9; + } + @Override + public byte getCasingTextureIndex() { + return 46; + } + + +} diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java new file mode 100644 index 0000000000..5ddd0e9069 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Plasma.java @@ -0,0 +1,93 @@ +package gregtech.common.tileentities.machines.multi; + +import java.util.ArrayList; +import java.util.Collection; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +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.items.GT_MetaGenerated_Tool; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; + +public class GT_MetaTileEntity_LargeTurbine_Plasma extends GT_MetaTileEntity_LargeTurbine{ + + public GT_MetaTileEntity_LargeTurbine_Plasma(int aID, String aName, String aNameRegional){super(aID, aName, aNameRegional);} + public GT_MetaTileEntity_LargeTurbine_Plasma(String aName){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_ACTIVE5):new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + + public String[] getDescription() + { + return new String[] { + "Controller Block for the Large Plasma Generator", + "Size: 3x3x4 (Hollow)", "Controller (front centered)", + "1x Input Hatch (side centered)", + "1x Dynamo Hatch (back centered)", + "1x Maintenance Hatch (side centered)", + "Turbine Casings for the rest (24 at least!)", + "Needs a Turbine Item (inside controller GUI)" }; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> steams = getStoredFluids(); + if (steams.size()>0) + {if(baseEff==0 || optFlow == 0 || counter >= 1000 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()){ + counter = 0; + baseEff = (int) ((50.0F+(10.0F*((GT_MetaGenerated_Tool)aStack.getItem()).getToolCombatDamage(aStack)))*100); + optFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool)aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() * ((GT_MetaGenerated_Tool)aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed*50); + optFlow *=10; + } + int tEU=0; + for(int i=0;i<steams.size();i++){ + int fuelValue = getFuelValue(steams.get(i)); + if(fuelValue>0&&depleteInput(new FluidStack(steams.get(i),optFlow/(fuelValue*2)))){ + tEU += optFlow/2;} + } + this.mEUt = baseEff*tEU/10000; + this.mMaxProgresstime = 1; + this.mEfficiencyIncrease = (this.mMaxProgresstime * 10); + if(mEUt==0){return false;} + return true; + } + return false; + } + + public int getFuelValue(FluidStack aLiquid) { + if (aLiquid == null || GT_Recipe_Map.sTurbineFuels == null) return 0; + FluidStack tLiquid; + Collection<GT_Recipe> tRecipeList = GT_Recipe_Map.sPlasmaFuels.mRecipeList; + if (tRecipeList != null) for (GT_Recipe tFuel : tRecipeList) if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null) if (aLiquid.isFluidEqual(tLiquid)) return tFuel.mSpecialValue; + return 0; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {return new GT_MetaTileEntity_LargeTurbine_Plasma(mName);} + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + @Override + public byte getCasingMeta() { + return 9; + } + @Override + public byte getCasingTextureIndex() { + return 46; + } + + +} diff --git a/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java new file mode 100644 index 0000000000..2170cfa543 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine_Steam.java @@ -0,0 +1,89 @@ +package gregtech.common.tileentities.machines.multi; + +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; +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.items.GT_MetaGenerated_Tool; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; + +public class GT_MetaTileEntity_LargeTurbine_Steam extends GT_MetaTileEntity_LargeTurbine{ + + public GT_MetaTileEntity_LargeTurbine_Steam(int aID, String aName, String aNameRegional){super(aID, aName, aNameRegional);} + public GT_MetaTileEntity_LargeTurbine_Steam(String aName){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_ACTIVE5):new GT_RenderedTexture(Textures.BlockIcons.LARGETURBINE5) : Textures.BlockIcons.CASING_BLOCKS[57]}; + } + + + public String[] getDescription() + { + return new String[] { + "Controller Block for the Large Steam Turbine", + "Size: 3x3x4 (Hollow)", "Controller (front centered)", + "1x Input Hatch (side centered)", "1x Output Hatch(side centered)", + "1x Dynamo Hatch (back centered)", + "1x Maintenance Hatch (side centered)", + "Turbine Casings for the rest (24 at least!)", + "Needs a Turbine Item (inside controller GUI)" }; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + ArrayList<FluidStack> steams = getStoredFluids(); + if (steams.size()>0) + {if(baseEff==0 || optFlow == 0 || counter >= 1000 || this.getBaseMetaTileEntity().hasWorkJustBeenEnabled() || this.getBaseMetaTileEntity().hasInventoryBeenModified()){ + counter = 0; + baseEff = (int) ((50.0F+(10.0F*((GT_MetaGenerated_Tool)aStack.getItem()).getToolCombatDamage(aStack)))*100); + optFlow = (int) Math.max(Float.MIN_NORMAL, ((GT_MetaGenerated_Tool)aStack.getItem()).getToolStats(aStack).getSpeedMultiplier() * ((GT_MetaGenerated_Tool)aStack.getItem()).getPrimaryMaterial(aStack).mToolSpeed*50); + } + int tEU=0; + int distOut=0; + for(int i=0;i<steams.size();i++){ + if(steams.get(i).getFluid().getUnlocalizedName(steams.get(i)).equals("fluid.steam")||steams.get(i).getFluid().getUnlocalizedName(steams.get(i)).equals("fluid.ic2steam")){ + int out = Math.min((int)(optFlow*1.5f),steams.get(i).amount); + depleteInput(new FluidStack(steams.get(i),out)); + distOut += out/160; + tEU += steams.get(i).amount/2; + } + } + if(tEU<optFlow/20){tEU=0;} + if(tEU>optFlow/2) {tEU = optFlow/2;} + float tEff = tEU/(optFlow/2); + this.mEUt = (int) (tEff*tEU*baseEff/10000); + this.mMaxProgresstime = 1; +// System.out.println("Eff: "+baseEff+" optFlow: "+optFlow+" tEff: "+tEff+" eut: "+mEUt+" out: "+distOut); + this.mEfficiencyIncrease = (this.mMaxProgresstime * 10); + if(mEUt==0){return false;} + addOutput(GT_ModHandler.getDistilledWater(distOut)); + return true; + } + return false; + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {return new GT_MetaTileEntity_LargeTurbine_Steam(mName);} + @Override + public Block getCasingBlock() { + return GregTech_API.sBlockCasings4; + } + @Override + public byte getCasingMeta() { + return 9; + } + @Override + public byte getCasingTextureIndex() { + return 46; + } + + +} |