diff options
Diffstat (limited to 'main/java/gregtech/common/tileentities/machines')
5 files changed, 875 insertions, 22 deletions
diff --git a/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java index 8d05b6e5a2..cb00b8599a 100644 --- a/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java +++ b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Boxinator.java @@ -1,6 +1,7 @@ /* 1: */ package gregtech.common.tileentities.machines.basic;
/* 2: */
-/* 3: */ import gregtech.api.enums.ItemList;
+/* 3: */ import gregtech.api.enums.GT_Values;
+import gregtech.api.enums.ItemList;
import gregtech.api.enums.Textures;
/* 4: */ import gregtech.api.enums.Textures.BlockIcons;
/* 5: */ import gregtech.api.interfaces.ITexture;
@@ -91,15 +92,17 @@ import gregtech.api.util.GT_Recipe; /* 89:71 */ return 0;
/* 90: */ }
/* 91: */
-/* 92: */ public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
-/* 93: */ {
-/* 94:76 */ if (super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack))
-/* 95: */ {
-/* 96:76 */ if (((getInputSlot() == aIndex) || (!ItemList.Crate_Empty.isStackEqual(aStack))) && (!ItemList.Schematic_1by1.isStackEqual(getInputAt(1))) && (!ItemList.Schematic_2by2.isStackEqual(getInputAt(1))) && (!ItemList.Schematic_3by3.isStackEqual(getInputAt(1)))) {}
-/* 97:76 */ return GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, gregtech.api.enums.GT_Values.V[this.mTier], null, new ItemStack[] { GT_Utility.copyAmount(64L, new Object[] { aStack }), getInputAt(1) }) != null;
-/* 98: */ }
-/* 99:77 */ return false;
-/* :0: */ }
+public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack)
+{
+ if(super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack))
+ return getInputSlot() != aIndex && ItemList.Crate_Empty.isStackEqual(aStack) || ItemList.Schematic_1by1.isStackEqual(getInputAt(1)) || ItemList.Schematic_2by2.isStackEqual(getInputAt(1)) || ItemList.Schematic_3by3.isStackEqual(getInputAt(1)) || gregtech.api.util.GT_Recipe.GT_Recipe_Map.sBoxinatorRecipes.findRecipe(getBaseMetaTileEntity(), true, GT_Values.V[mTier], null, new ItemStack[] {
+ GT_Utility.copyAmount(64L, new Object[] {
+ aStack
+ }), getInputAt(1)
+ }) != null;
+ else
+ return false;
+}
/* :1: */ }
diff --git a/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java new file mode 100644 index 0000000000..5abb3be3c1 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Pump.java @@ -0,0 +1,374 @@ +package gregtech.common.tileentities.machines.basic; + +import static gregtech.api.enums.GT_Values.V; + +import java.util.ArrayList; +import java.util.Iterator; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.ChunkPosition; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.IFluidBlock; +import gregtech.api.enums.Textures; +import gregtech.api.gui.GT_Container_BasicTank; +import gregtech.api.gui.GT_GUIContainer_BasicTank; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachine; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; + +public class GT_MetaTileEntity_Pump extends GT_MetaTileEntity_Hatch { + + public ArrayList<ChunkPosition> mPumpList = new ArrayList(); + public int mPumpTimer = 0; + public int mPumpCountBelow = 0; + public Block mPumpedBlock1 = null; + public Block mPumpedBlock2 = null; + + public GT_MetaTileEntity_Pump(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "The best way of emptying Oceans!"); + } + + public GT_MetaTileEntity_Pump(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription,aTextures); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Pump(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + public void saveNBTData(NBTTagCompound aNBT) { + super.saveNBTData(aNBT); + aNBT.setString("mPumpedBlock1", this.mPumpedBlock1 == null ? "" : this.mPumpedBlock1.getUnlocalizedName()); + aNBT.setString("mPumpedBlock2", this.mPumpedBlock2 == null ? "" : this.mPumpedBlock2.getUnlocalizedName()); + } + + public void loadNBTData(NBTTagCompound aNBT) { + super.loadNBTData(aNBT); + this.mPumpedBlock1 = Block.getBlockFromName(aNBT.getString("mPumpedBlock1")); + this.mPumpedBlock2 = Block.getBlockFromName(aNBT.getString("mPumpedBlock2")); + } + + @Override + public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + } + @Override + public boolean doesFillContainers() { + return true; + } + @Override + public boolean doesEmptyContainers() { + return false; + } + @Override + public boolean canTankBeFilled() { + return false; + } + @Override + public boolean canTankBeEmptied() { + return true; + } + @Override + public boolean displaysItemStack() { + return true; + } + @Override + public boolean displaysStackSize() { + return false; + } + + @Override + public boolean isFluidInputAllowed(FluidStack aFluid) { + return false; + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (getBaseMetaTileEntity().isServerSide()) { + this.mPumpTimer -= 1; + if ((getBaseMetaTileEntity() instanceof BaseTileEntity)) { + ((BaseTileEntity) getBaseMetaTileEntity()).ignoreUnloadedChunks = false; + } + this.doTickProfilingInThisTick = true; + this.mPumpCountBelow = 0; + IGregTechTileEntity tTileEntity; + for (int i = 1; (i < 21) && ((tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntityAtSideAndDistance((byte) 0, i)) != null) + && (tTileEntity.getMetaTileEntity() != null) && ((tTileEntity.getMetaTileEntity() instanceof GT_MetaTileEntity_Pump)); i++) { + getBaseMetaTileEntity().setActive(tTileEntity.isActive()); + this.mPumpCountBelow += 1; + ((GT_MetaTileEntity_Pump) tTileEntity.getMetaTileEntity()).mPumpTimer -= 1; + } + if (this.mPumpCountBelow <= 0) { + if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().isUniversalEnergyStored(16*((int)Math.pow(4, this.mTier)))) + && ((this.mFluid == null) || (this.mFluid.amount + 1000 <= getCapacity()))) { + boolean tMovedOneDown = false; + if ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 100L == 0L)) { + tMovedOneDown = moveOneDown(); + } + if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) { + getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead() - 1, getBaseMetaTileEntity().getZCoord()); + if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) { + getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead(), getBaseMetaTileEntity().getZCoord() + 1); + } + if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) { + getFluidAt(getBaseMetaTileEntity().getXCoord(), getYOfPumpHead(), getBaseMetaTileEntity().getZCoord() - 1); + } + if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) { + getFluidAt(getBaseMetaTileEntity().getXCoord() + 1, getYOfPumpHead(), getBaseMetaTileEntity().getZCoord()); + } + if ((GT_Utility.isBlockInvalid(this.mPumpedBlock1)) || (GT_Utility.isBlockInvalid(this.mPumpedBlock2))) { + getFluidAt(getBaseMetaTileEntity().getXCoord() - 1, getYOfPumpHead(), getBaseMetaTileEntity().getZCoord()); + } + } else if (getYOfPumpHead() < getBaseMetaTileEntity().getYCoord()) { + if ((tMovedOneDown) || ((this.mPumpList.isEmpty()) && (getBaseMetaTileEntity().getTimer() % 200L == 100L)) || (getBaseMetaTileEntity().getTimer() % 72000L == 100L)) { + this.mPumpList.clear(); + int y = getBaseMetaTileEntity().getYCoord() - 1; + for (int yHead = getYOfPumpHead(); (this.mPumpList.isEmpty()) && (y >= yHead); y--) { + scanForFluid(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), this.mPumpList, getBaseMetaTileEntity().getXCoord(), getBaseMetaTileEntity().getZCoord(), 8*((int)Math.pow(2, this.mTier))); + } + } + if ((!tMovedOneDown) && (this.mPumpTimer <= 0)) { + while ((!this.mPumpList.isEmpty()) + && (!consumeFluid(((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosX, + ((ChunkPosition) this.mPumpList.get(this.mPumpList.size() - 1)).chunkPosY, + ((ChunkPosition) this.mPumpList.remove(this.mPumpList.size() - 1)).chunkPosZ))) { + } + this.mPumpTimer = 160/((int)Math.pow(2, this.mTier)); + } + } + } + getBaseMetaTileEntity().setActive(!this.mPumpList.isEmpty()); + } + } + } + + private boolean moveOneDown() { + if ((this.mInventory[0] == null) || (this.mInventory[0].stackSize < 1) + || (!GT_Utility.areStacksEqual(this.mInventory[0], GT_ModHandler.getIC2Item("miningPipe", 1L)))) { + return false; + } + int yHead = getYOfPumpHead(); + if (yHead <= 0) { + return false; + } + if ((!consumeFluid(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord())) + && (!getBaseMetaTileEntity().getAir(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord()))) { + return false; + } + if (!(getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead - 1, getBaseMetaTileEntity().getZCoord(),GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))))) { + return false; + } + if (yHead != getBaseMetaTileEntity().getYCoord()) { + getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), yHead, getBaseMetaTileEntity().getZCoord(),GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))); + } + getBaseMetaTileEntity().decrStackSize(0, 1); + return true; + } + + private int getYOfPumpHead() { + int y = getBaseMetaTileEntity().getYCoord() - 1; + while (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) == GT_Utility + .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipe", 1L))) { + y--; + } + if (y == getBaseMetaTileEntity().getYCoord() - 1) { + if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility + .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { + return y + 1; + } + } else if (getBaseMetaTileEntity().getBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord()) != GT_Utility + .getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))) { + getBaseMetaTileEntity().getWorld().setBlock(getBaseMetaTileEntity().getXCoord(), y, getBaseMetaTileEntity().getZCoord(), + GT_Utility.getBlockFromStack(GT_ModHandler.getIC2Item("miningPipeTip", 1L))); + } + return y; + } + + private void scanForFluid(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList, int mX, int mZ, int mDist) { + doTickProfilingInThisTick = false; + ArrayList tList1 = new ArrayList(); + ArrayList tList2 = new ArrayList(); + tList1.add(new ChunkPosition(aX, aY, aZ)); + while(!tList1.isEmpty()) + { + Iterator i$ = tList1.iterator(); + do + { + if(!i$.hasNext()) + break; + ChunkPosition tPos = (ChunkPosition)i$.next(); + if(tPos.chunkPosX < mX + mDist) + addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX + 1, tPos.chunkPosY, tPos.chunkPosZ, tList2, aList); + if(tPos.chunkPosX > mX - mDist) + addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX - 1, tPos.chunkPosY, tPos.chunkPosZ, tList2, aList); + if(tPos.chunkPosZ < mZ + mDist) + addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ + 1, tList2, aList); + if(tPos.chunkPosZ > mZ - mDist) + addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX, tPos.chunkPosY, tPos.chunkPosZ - 1, tList2, aList); + addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(tPos.chunkPosX, tPos.chunkPosY + 1, tPos.chunkPosZ, tList2, aList); + ChunkPosition tCoordinate = new ChunkPosition(aX, aY + 1, aZ); + if(tPos.chunkPosX == mX && tPos.chunkPosZ == mZ && tPos.chunkPosY < getBaseMetaTileEntity().getYCoord() && !aList.contains(tCoordinate) && !tList2.contains(tCoordinate)) + tList2.add(tCoordinate); + } while(true); + aList.addAll(tList2); + tList1 = tList2; + tList2 = new ArrayList(); + } + for(int y = getBaseMetaTileEntity().getYCoord(); y >= aY; y--) + aList.remove(new ChunkPosition(aX, y, aZ)); + } + + private boolean addToFirstListIfFluidAndNotAlreadyAddedToAnyOfTheLists(int aX, int aY, int aZ, ArrayList<ChunkPosition> aList1, + ArrayList<ChunkPosition> aList2) { + ChunkPosition tCoordinate = new ChunkPosition(aX, aY, aZ); + if ((!aList1.contains(tCoordinate)) && (!aList2.contains(tCoordinate))) { + Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); + if ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock)) { + aList1.add(tCoordinate); + return true; + } + } + return false; + } + + private void getFluidAt(int aX, int aY, int aZ) { + Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); + if (GT_Utility.isBlockValid(aBlock)) { + if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) { + this.mPumpedBlock1 = Blocks.water; + this.mPumpedBlock2 = Blocks.flowing_water; + return; + } + if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) { + this.mPumpedBlock1 = Blocks.lava; + this.mPumpedBlock2 = Blocks.flowing_lava; + return; + } + if ((aBlock instanceof IFluidBlock)) { + this.mPumpedBlock1 = aBlock; + this.mPumpedBlock2 = aBlock; + return; + } + } + this.mPumpedBlock1 = null; + this.mPumpedBlock2 = null; + } + + private boolean consumeFluid(int aX, int aY, int aZ) { + Block aBlock = getBaseMetaTileEntity().getBlock(aX, aY, aZ); + int aMeta = getBaseMetaTileEntity().getMetaID(aX, aY, aZ); + if ((GT_Utility.isBlockValid(aBlock)) && ((this.mPumpedBlock1 == aBlock) || (this.mPumpedBlock2 == aBlock))) { + if ((aBlock == Blocks.water) || (aBlock == Blocks.flowing_water)) { + if (aMeta == 0) { + if (this.mFluid == null) { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true); + this.mFluid = GT_ModHandler.getWater(1000L); + } else if (GT_ModHandler.isWater(this.mFluid)) { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true); + this.mFluid.amount += 1000; + } else { + return false; + } + } else { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(4*((int)Math.pow(4, this.mTier)), true); + } + } + if ((aBlock == Blocks.lava) || (aBlock == Blocks.flowing_lava)) { + if (aMeta == 0) { + if (this.mFluid == null) { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true); + this.mFluid = GT_ModHandler.getLava(1000L); + } else if (GT_ModHandler.isLava(this.mFluid)) { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(16*((int)Math.pow(4, this.mTier)), true); + this.mFluid.amount += 1000; + } else { + return false; + } + } else { + getBaseMetaTileEntity().decreaseStoredEnergyUnits(4*((int)Math.pow(4, this.mTier)), true); + } + } + if ((aBlock instanceof IFluidBlock)) { + if (this.mFluid == null) { + this.mFluid = ((IFluidBlock) aBlock).drain(getBaseMetaTileEntity().getWorld(), aX, aY, aZ, true); + getBaseMetaTileEntity().decreaseStoredEnergyUnits(this.mFluid == null ? 1000 : this.mFluid.amount, true); + } else { + return false; + } + } + getBaseMetaTileEntity().getWorld().setBlock(aX, aY, aZ,Blocks.air,0,2); + return true; + } + return false; + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) return true; + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + + @Override public boolean isSimpleMachine() {return false;} + @Override public boolean isOverclockerUpgradable() {return false;} + @Override public boolean isTransformerUpgradable() {return false;} + @Override public boolean isElectric() {return true;} + @Override public boolean isFacingValid(byte aFacing) {return true;} + @Override public boolean isEnetInput() {return true;} + @Override public boolean isInputFacing(byte aSide) {return true;} + @Override public boolean isOutputFacing(byte aSide) {return false;} + @Override public boolean isTeleporterCompatible() {return false;} + @Override public long getMinimumStoredEU() {return V[mTier]*16;} + @Override public long maxEUStore() {return V[mTier]*64;} + @Override public long maxEUInput() {return V[mTier];} + @Override public long maxSteamStore() {return maxEUStore();} + @Override public long maxAmperesIn() {return 2;} + @Override public int getStackDisplaySlot() {return 2;} + @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} + + + @Override + public int getCapacity() { + return 16000*this.mTier; + } + @Override + public int getTankPressure() { + return 100; + } + + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1], (aSide == 0||aSide ==1) ? null : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP) }; + } + + @Override + public ITexture[] getTexturesActive(ITexture aBaseTexture) { + return getTexturesInactive(aBaseTexture); + } + + @Override + public ITexture[] getTexturesInactive(ITexture aBaseTexture) { + return new ITexture[] { + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP), + new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_ADV_PUMP),}; + } +} diff --git a/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java new file mode 100644 index 0000000000..9102bd7196 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -0,0 +1,301 @@ +package gregtech.common.tileentities.machines.basic; + +import static gregtech.api.enums.GT_Values.V; +import net.minecraft.client.particle.EntityFX; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityHanging; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.boss.EntityDragonPart; +import net.minecraft.entity.effect.EntityWeatherEffect; +import net.minecraft.entity.item.EntityBoat; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.item.EntityEnderEye; +import net.minecraft.entity.item.EntityFireworkRocket; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.EntityMinecart; +import net.minecraft.entity.item.EntityTNTPrimed; +import net.minecraft.entity.item.EntityXPOrb; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.entity.projectile.EntityFireball; +import net.minecraft.entity.projectile.EntityFishHook; +import net.minecraft.entity.projectile.EntityThrowable; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.AxisAlignedBB; +import gregtech.api.enums.ConfigCategories; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Config; +import gregtech.api.util.GT_Utility; + +public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_Hatch{ + + public int mTargetX = 0; + public int mTargetY = 0; + public int mTargetZ = 0; + public int mTargetD = 0; + public int mCharge = 0; + public boolean mDebug = false; + public boolean hasEgg = false; + public static boolean sInterDimensionalTeleportAllowed = true; + + public GT_MetaTileEntity_Teleporter(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, 3, "Teleport long distances with this little device."); + } + + public GT_MetaTileEntity_Teleporter(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription,aTextures); + } + + @Override public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {return true;} + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_Teleporter(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + public String[] getInfoData() + { + return new String[] { "Charge:", this.mCharge + " EU", "Coordinates:", "X: " + this.mTargetX, "Y: " + this.mTargetY, "Z: " + this.mTargetZ, "Dimension: " + this.mTargetD }; + } + + @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) {return null;} + @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) {return null;} + @Override + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) { + return new ITexture[] {Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex+1], (aSide !=1) ? null : aActive ? new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER_ACTIVE) : new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TELEPORTER) }; + } + + + public void saveNBTData(NBTTagCompound aNBT) + { + aNBT.setInteger("mTargetX", this.mTargetX); + aNBT.setInteger("mTargetY", this.mTargetY); + aNBT.setInteger("mTargetZ", this.mTargetZ); + aNBT.setInteger("mTargetD", this.mTargetD); + aNBT.setInteger("mCharge", this.mCharge); + aNBT.setBoolean("mDebug", this.mDebug); + } + + public void loadNBTData(NBTTagCompound aNBT) + { + this.mTargetX = aNBT.getInteger("mTargetX"); + this.mTargetY = aNBT.getInteger("mTargetY"); + this.mTargetZ = aNBT.getInteger("mTargetZ"); + this.mTargetD = aNBT.getInteger("mTargetD"); + this.mCharge = aNBT.getInteger("mCharge"); + this.mDebug = aNBT.getBoolean("mDebug"); + } + + public void onConfigLoad(GT_Config aConfig) + { + sInterDimensionalTeleportAllowed = aConfig.get(ConfigCategories.machineconfig, "Teleporter.Interdimensional", true); + } + + public void onFirstTick() + { + if (getBaseMetaTileEntity().isServerSide()) + { + if ((this.mTargetX == 0) && (this.mTargetY == 0) && (this.mTargetZ == 0) && (this.mTargetD == 0)) + { + this.mTargetX = getBaseMetaTileEntity().getXCoord(); + this.mTargetY = getBaseMetaTileEntity().getYCoord(); + this.mTargetZ = getBaseMetaTileEntity().getZCoord(); + this.mTargetD = getBaseMetaTileEntity().getWorld().provider.dimensionId; + } + this.hasEgg = checkForEgg(); + } + } + + public boolean checkForEgg() + { + for (byte i = -5; i <= 5; i = (byte)(i + 1)) { + for (byte j = -5; j <= 5; j = (byte)(j + 1)) { + for (byte k = -5; k <= 5; k = (byte)(k + 1)) { + if (getBaseMetaTileEntity().getBlockOffset(i, j, k) == Blocks.dragon_egg) { + return true; + } + } + } + } + return false; + } + + public boolean hasDimensionalTeleportCapability() + { + return (this.mDebug) || (this.hasEgg); + } + + public boolean isDimensionalTeleportAvailable() + { + return (this.mDebug) || ((hasDimensionalTeleportCapability()) && (GT_Utility.isRealDimension(this.mTargetD)) && (GT_Utility.isRealDimension(getBaseMetaTileEntity().getWorld().provider.dimensionId))); + } + + public void onPostTick() + { + if (getBaseMetaTileEntity().isServerSide()) + { + if (getBaseMetaTileEntity().getTimer() % 100L == 50L) { + this.hasEgg = checkForEgg(); + } + if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) + { + this.mCharge -= 8192; + if (this.mCharge < 0) { + this.mCharge = 0; + } + int tDistance = distanceCalculation();int tCost = 0; + for (Object tObject : getBaseMetaTileEntity().getWorld().getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) - 1, getBaseMetaTileEntity().getOffsetX(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetY(getBaseMetaTileEntity().getFrontFacing(), 2) + 2, getBaseMetaTileEntity().getOffsetZ(getBaseMetaTileEntity().getFrontFacing(), 2) + 2))) { + if (((tObject instanceof Entity)) && (!((Entity)tObject).isDead)) + { + Entity tEntity = (Entity)tObject; + if (((this.mCharge >= (tCost = (int)(tDistance * tDistance * weightCalculation(tEntity)))) && (tCost >= 0)) || (this.mDebug)) + { + if (!this.mDebug) { + this.mCharge -= tCost; + } + if (tEntity.ridingEntity != null) { + tEntity.mountEntity(null); + } + if (tEntity.riddenByEntity != null) { + tEntity.riddenByEntity.mountEntity(null); + } + if ((this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) || (!isDimensionalTeleportAvailable()) || (!GT_Utility.moveEntityToDimensionAtCoords(tEntity, this.mTargetD, this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D))) { + if ((tEntity instanceof EntityLivingBase)) { + ((EntityLivingBase)tEntity).setPosition(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D); + } else { + tEntity.setPosition(this.mTargetX + 0.5D, this.mTargetY + 0.5D, this.mTargetZ + 0.5D); + } + } + } + else + { + long tCharge = getBaseMetaTileEntity().getUniversalEnergyStored(); + if ((tCharge > 0) && (this.mCharge + tCharge > 0)) + { + this.mCharge += tCharge; + getBaseMetaTileEntity().decreaseStoredEnergyUnits(tCharge, true); + } + } + } + } + getBaseMetaTileEntity().setActive(true); + } + else + { + getBaseMetaTileEntity().setActive(false); + } + } + } + + private int distanceCalculation() + { + return Math.abs(((this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId) && (isDimensionalTeleportAvailable()) ? 100 : 1) * (int)Math.sqrt(Math.pow(getBaseMetaTileEntity().getXCoord() - this.mTargetX, 2.0D) + Math.pow(getBaseMetaTileEntity().getYCoord() - this.mTargetY, 2.0D) + Math.pow(getBaseMetaTileEntity().getZCoord() - this.mTargetZ, 2.0D))); + } + + private static float weightCalculation(Entity aEntity) + { + try + { + if ((aEntity instanceof EntityFX)) { + return -1.0F; + } + } + catch (Throwable e) {} + if ((aEntity instanceof EntityFishHook)) { + return -1.0F; + } + if ((aEntity instanceof EntityDragonPart)) { + return -1.0F; + } + if ((aEntity instanceof EntityWeatherEffect)) { + return -1.0F; + } + if ((aEntity instanceof EntityPlayer)) + { + EntityPlayer tPlayer = (EntityPlayer)aEntity; + int tCount = 64; + for (int i = 0; i < 36; i++) { + if (tPlayer.inventory.getStackInSlot(i) != null) { + tCount += (tPlayer.inventory.getStackInSlot(i).getMaxStackSize() > 1 ? tPlayer.inventory.getStackInSlot(i).stackSize : 64); + } + } + for (int i = 0; i < 4; i++) { + if (tPlayer.inventory.armorInventory[i] != null) { + tCount += 256; + } + } + return Math.min(5.0F, tCount / 666.6F); + } + if (GT_Utility.getClassName(aEntity).equals("EntityItnt")) { + return 5.0F; + } + if (GT_Utility.getClassName(aEntity).equals("EntityNuke")) { + return 50.0F; + } + if ((aEntity instanceof EntityArrow)) { + return 0.001F; + } + if ((aEntity instanceof EntityBoat)) { + return 0.1F; + } + if ((aEntity instanceof EntityEnderCrystal)) { + return 2.0F; + } + if ((aEntity instanceof EntityEnderEye)) { + return 0.001F; + } + if ((aEntity instanceof EntityFireball)) { + return 0.001F; + } + if ((aEntity instanceof EntityFireworkRocket)) { + return 0.001F; + } + if ((aEntity instanceof EntityHanging)) { + return 0.005F; + } + if ((aEntity instanceof EntityItem)) { + return 0.001F; + } + if ((aEntity instanceof EntityLiving)) { + return 0.5F; + } + if ((aEntity instanceof EntityMinecart)) { + return 0.1F; + } + if ((aEntity instanceof EntityThrowable)) { + return 0.001F; + } + if ((aEntity instanceof EntityTNTPrimed)) { + return 5.0F; + } + if ((aEntity instanceof EntityXPOrb)) { + return 0.001F; + } + return -1.0F; + } + + @Override public boolean isSimpleMachine() {return false;} + @Override public boolean isOverclockerUpgradable() {return false;} + @Override public boolean isTransformerUpgradable() {return false;} + @Override public boolean isElectric() {return true;} + @Override public boolean isFacingValid(byte aFacing) {return true;} + @Override public boolean isEnetInput() {return true;} + @Override public boolean isInputFacing(byte aSide) {return true;} + @Override public boolean isOutputFacing(byte aSide) {return false;} + @Override public boolean isTeleporterCompatible() {return false;} + @Override public long getMinimumStoredEU() {return V[mTier]*16;} + @Override public long maxEUStore() {return 100000000;} + @Override public long maxEUInput() {return V[mTier];} + @Override public long maxSteamStore() {return maxEUStore();} + @Override public long maxAmperesIn() {return 2;} + @Override public int getStackDisplaySlot() {return 2;} + @Override public boolean isAccessAllowed(EntityPlayer aPlayer) {return true;} + +} 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 bdfb51d5ac..975089e607 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 @@ -249,10 +249,8 @@ public boolean checkRecipe(ItemStack aStack) { if(tInput2.mFluid!=null&& tInput2.mFluid!=null&&tInput2.mFluid.getFluid().getID()==this.mLastRecipe.mFluidInputs[1].getFluid().getID()&&tInput2.mFluid.amount>=this.mLastRecipe.mFluidInputs[1].amount&&getMaxInputVoltage()>=this.mLastRecipe.mEUt){ tInput.drain(this.mLastRecipe.mFluidInputs[0].amount, true); tInput2.drain(this.mLastRecipe.mFluidInputs[1].amount, true); - - this.mEUt = -(this.mLastRecipe.mEUt*overclock(this.mLastRecipe.mEUt)); + this.mEUt = (this.mLastRecipe.mEUt*overclock(this.mLastRecipe.mEUt)); this.mMaxProgresstime = this.mLastRecipe.mDuration/overclock(this.mLastRecipe.mEUt); - this.mEfficiencyIncrease = 10000; this.mOutputFluids = this.mLastRecipe.mFluidOutputs; turnCasingActive(true); @@ -268,16 +266,16 @@ public boolean checkRecipe(ItemStack aStack) { FluidStack tFluid = tRecipe.mFluidInputs[0]; if(tFluid!=null){ for(GT_MetaTileEntity_Hatch_Input tInput : this.mInputHatches){ - if(tFluid.fluid !=null&& tInput.getFluid()!=null && tFluid.fluid.getID()==tInput.getFluid().getFluid().getID()&&tFluid.amount<=tInput.getFluid().amount){ + if(tFluid.getFluid() !=null&& tInput.getFluid()!=null && tFluid.getFluid().getID()==tInput.getFluid().getFluid().getID()&&tFluid.amount<=tInput.getFluid().amount){ FluidStack tFluid2 = tRecipe.mFluidInputs[1]; if(tFluid2!=null){ for(GT_MetaTileEntity_Hatch_Input tInput2 : this.mInputHatches){ - if(tFluid2.fluid !=null&& tInput2.getFluid()!=null&&tFluid2.fluid.getID()==tInput2.getFluid().getFluid().getID()&&tFluid2.amount<=tInput2.getFluid().amount&&getMaxInputVoltage()>=tRecipe.mEUt&&this.mEUStore>=tRecipe.mSpecialValue){ + if(tFluid2.getFluid() !=null&& tInput2.getFluid()!=null&&tFluid2.getFluid().getID()==tInput2.getFluid().getFluid().getID()&&tFluid2.amount<=tInput2.getFluid().amount&&getMaxInputVoltage()>=tRecipe.mEUt&&this.mEUStore>=tRecipe.mSpecialValue){ tInput.drain(tFluid.amount, true); tInput2.drain(tFluid2.amount, true); this.mLastRecipe=tRecipe; - this.mEUt = -(tRecipe.mEUt*overclock(this.mLastRecipe.mEUt)); + this.mEUt = (tRecipe.mEUt*overclock(this.mLastRecipe.mEUt)); this.mMaxProgresstime = tRecipe.mDuration/overclock(this.mLastRecipe.mEUt); this.mEfficiencyIncrease = 10000; @@ -355,11 +353,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { } if (getRepairStatus() > 0) { if (mMaxProgresstime > 0 && doRandomMaintenanceDamage()) { - if (aBaseMetaTileEntity.decreaseStoredEnergyUnits(mEUt, false)) { - if (!polluteEnvironment(getPollutionPerTick(mInventory[1]))) { - stopMachine(); - } - + this.getBaseMetaTileEntity().decreaseStoredEnergyUnits(mEUt, true); if (mMaxProgresstime > 0 && ++mProgresstime>=mMaxProgresstime) { if (mOutputItems != null) for (ItemStack tStack : mOutputItems) if (tStack != null) addOutput(tStack); if (mOutputFluids != null) for (FluidStack tStack : mOutputFluids) if (tStack != null) addOutput(tStack); @@ -371,7 +365,6 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { this.mEUStore=(int) aBaseMetaTileEntity.getStoredEU(); if (aBaseMetaTileEntity.isAllowedToWork()) checkRecipe(mInventory[1]); } - } } else { if (aTick % 100 == 0 || aBaseMetaTileEntity.hasWorkJustBeenEnabled() || aBaseMetaTileEntity.hasInventoryBeenModified()) { turnCasingActive(mMaxProgresstime>0); @@ -385,10 +378,12 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { } } } else { + this.mLastRecipe=null; stopMachine(); } } else { turnCasingActive(false); + this.mLastRecipe=null; stopMachine(); } } @@ -401,6 +396,7 @@ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { public boolean onRunningTick(ItemStack aStack) { if (mEUt < 0) { if (!drainEnergyInput(((long)-mEUt * 10000) / Math.max(1000, mEfficiency))) { + this.mLastRecipe=null; stopMachine(); return false; } 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 new file mode 100644 index 0000000000..9d15000b36 --- /dev/null +++ b/main/java/gregtech/common/tileentities/machines/multi/GT_MetaTileEntity_LargeTurbine.java @@ -0,0 +1,179 @@ +package gregtech.common.tileentities.machines.multi; + +import net.minecraft.item.ItemStack; +import gregtech.api.GregTech_API; +import gregtech.api.enums.ItemList; +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.metatileentity.implementations.GT_MetaTileEntity_Hatch_Dynamo; +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_Utility; + +public 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 String[] getDescription() { + return new String[]{"Consumes 1600 Liters of Steam per Tick"}; + } + + @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],new GT_RenderedTexture(Textures.BlockIcons.STEAM_TURBINE_SIDE)}; + } + + @Override + public boolean isCorrectMachinePart(ItemStack aStack) { + return getMaxEfficiency(aStack) > 0; + } + + @Override + public boolean checkRecipe(ItemStack aStack) { + + if (depleteInput(GT_ModHandler.getSteam(1600L))) + { + this.mEUt = 800; + 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.getWater(10L)); + return true; + } + return false; + } + + @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 GT_MetaTileEntity_LargeTurbine))) { + 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 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == GregTech_API.sBlockCasings4) + { + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 13) {} + } + 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) + { + if (getBaseMetaTileEntity().getMetaID(tX + (tSide == 5 ? k : tSide < 4 ? i : -k), tY + j, tZ + (tSide < 4 ? -k : tSide == 3 ? k : i)) == 13) {} + } + 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()); + } else { + return false; + } + } + } + else + { + return false; + } + return true; + } + + private boolean addToMachineList(IGregTechTileEntity tTileEntity){ + return ((!addMaintenanceToMachineList(tTileEntity, 11)) && (!addInputToMachineList(tTileEntity, 11)) && (!addOutputToMachineList(tTileEntity, 11))); + } + + @Override + public int getDamageToComponent(ItemStack aStack) { + return GT_Utility.areStacksEqual(GT_ModHandler.getModItem("Railcraft","part.turbine.rotor", 1L, 32767), aStack) ? 2 : 1; + } + + + public int getMaxEfficiency(ItemStack aStack) + { + if (GT_Utility.isStackInvalid(aStack)) { + return 0; + } + if (ItemList.Component_Turbine_Bronze.isStackEqual(aStack, true, true)) { + return 6000; + } + if (ItemList.Component_Turbine_Steel.isStackEqual(aStack, true, true)) { + return 8000; + } + if (ItemList.Component_Turbine_Magnalium.isStackEqual(aStack, true, true)) { + return 10000; + } + if (ItemList.Component_Turbine_TungstenSteel.isStackEqual(aStack, true, true)) { + return 9000; + } + if (ItemList.Component_Turbine_Carbon.isStackEqual(aStack, true, true)) { + return 12500; + } + if (GT_Utility.areStacksEqual(aStack, GT_ModHandler.getModItem("Railcraft","part.turbine.rotor", 1L, 32767))) { + return 8000; + } + return 0; + } + + + @Override + public int getPollutionPerTick(ItemStack aStack) {return 0;} + @Override + 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);} + +} |