diff options
author | Dream-Master <dream-master@gmx.net> | 2015-12-28 21:04:13 +0100 |
---|---|---|
committer | Dream-Master <dream-master@gmx.net> | 2015-12-28 21:04:13 +0100 |
commit | faa4c18f63edb46e60da26e64b597d19abb6b49e (patch) | |
tree | 6f9903f95d8625515196951bda18f4e930b93ae8 /src/main/java/gregtech/common | |
parent | d4da3377abba1647195a4f96563b1da637d3baac (diff) | |
download | GT5-Unofficial-faa4c18f63edb46e60da26e64b597d19abb6b49e.tar.gz GT5-Unofficial-faa4c18f63edb46e60da26e64b597d19abb6b49e.tar.bz2 GT5-Unofficial-faa4c18f63edb46e60da26e64b597d19abb6b49e.zip |
Added Blood Asps commits.
New debug lang for achievements generation(miuirussia)
fuel rod override v2(Blood Asp) Mox not working lik ic2 any more (more heat up more eu)
Overriding IC2 fuel rods(Blood Asp)
fix teleporter(Blood Asp)
Sensor kit should not stack(Blood Asp)
Fix teleporter nuclear control support(Blood Asp)
Fixed Display overflow(Blood Asp)
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/items/GT_DepletetCell_Item.java | 2 | ||||
-rw-r--r-- | src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java | 73 |
2 files changed, 68 insertions, 7 deletions
diff --git a/src/main/java/gregtech/common/items/GT_DepletetCell_Item.java b/src/main/java/gregtech/common/items/GT_DepletetCell_Item.java index add80f07c3..9d23d09587 100644 --- a/src/main/java/gregtech/common/items/GT_DepletetCell_Item.java +++ b/src/main/java/gregtech/common/items/GT_DepletetCell_Item.java @@ -7,7 +7,7 @@ import net.minecraft.item.ItemStack; public class GT_DepletetCell_Item extends GT_RadioactiveCellIC_Item { public GT_DepletetCell_Item(String aUnlocalized, String aEnglish, int aRadiation) { - super(aUnlocalized, aEnglish, 1, 1, 0, aRadiation, 0); + super(aUnlocalized, aEnglish, 1, 1, 0, aRadiation, 0, null, false); } public void processChamber(IReactor paramIReactor, ItemStack paramItemStack, int paramInt1, int paramInt2, boolean paramBoolean) { diff --git a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java index ee47231746..0410c92717 100644 --- a/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java +++ b/src/main/java/gregtech/common/tileentities/machines/basic/GT_MetaTileEntity_Teleporter.java @@ -1,6 +1,7 @@ package gregtech.common.tileentities.machines.basic; import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.Materials; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; @@ -26,9 +27,13 @@ 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.inventory.IInventory; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; - +import net.minecraft.world.World; +import net.minecraftforge.common.DimensionManager; +import net.minecraftforge.fluids.FluidStack; import static gregtech.api.enums.GT_Values.V; public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @@ -151,6 +156,12 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { return new GT_MetaTileEntity_Teleporter(this.mName, this.mTier, this.mDescription, this.mTextures); } + @Override + public boolean isGivingInformation() { + return true; + } + + public String[] getInfoData() { return new String[]{"Coordinates:", "X: " + this.mTargetX, "Y: " + this.mTargetY, "Z: " + this.mTargetZ, "Dimension: " + this.mTargetD}; } @@ -161,6 +172,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } public void saveNBTData(NBTTagCompound aNBT) { + if (mFluid != null) aNBT.setTag("mFluid", mFluid.writeToNBT(new NBTTagCompound())); aNBT.setInteger("mTargetX", this.mTargetX); aNBT.setInteger("mTargetY", this.mTargetY); aNBT.setInteger("mTargetZ", this.mTargetZ); @@ -169,6 +181,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } public void loadNBTData(NBTTagCompound aNBT) { + mFluid = FluidStack.loadFluidStackFromNBT(aNBT.getCompoundTag("mFluid")); this.mTargetX = aNBT.getInteger("mTargetX"); this.mTargetY = aNBT.getInteger("mTargetY"); this.mTargetZ = aNBT.getInteger("mTargetZ"); @@ -206,7 +219,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } public boolean hasDimensionalTeleportCapability() { - return (this.mDebug) || (this.hasEgg); + return (this.mDebug) || (this.hasEgg) || (mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)) && mFluid.amount >= 1000); } public boolean isDimensionalTeleportAvailable() { @@ -215,18 +228,52 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @Override public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (mFluid == null) { + mFluid = Materials.Nitrogen.getPlasma(0); + } super.onPostTick(aBaseMetaTileEntity, aTick); if (getBaseMetaTileEntity().isServerSide()) { if (getBaseMetaTileEntity().getTimer() % 100L == 50L) { this.hasEgg = checkForEgg(); } if ((getBaseMetaTileEntity().isAllowedToWork()) && (getBaseMetaTileEntity().getRedstone())) { - if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(8192, false)) { + if (getBaseMetaTileEntity().decreaseStoredEnergyUnits(2048, false)) { + if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) { + mFluid.amount--; + if (mFluid.amount < 1) { + mFluid = null; + } + } int tDistance = distanceCalculation(); + if (mInventory[0] != null) { + TileEntity tTile = null; + if (this.mTargetD == getBaseMetaTileEntity().getWorld().provider.dimensionId) { + tTile = getBaseMetaTileEntity().getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ); + } else { + World tWorld = DimensionManager.getWorld(this.mTargetD); + if (tWorld != null) { + tTile = tWorld.getTileEntity(this.mTargetX, this.mTargetY, this.mTargetZ); + } + } + if (tTile != null && tTile instanceof IInventory) { + int tStacksize = mInventory[0].stackSize; + GT_Utility.moveOneItemStack(this, tTile, (byte) 0, (byte) 0, null, false, (byte) 64, (byte) 1, (byte) 64, (byte) 1); + if (mInventory[0] == null || mInventory[0].stackSize < tStacksize) { + getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * (tStacksize - (mInventory[0] == null ? 0 : mInventory[0].stackSize))), false); + } + } + + } 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 (getBaseMetaTileEntity().decreaseStoredEnergyUnits((int) (tDistance * tDistance * weightCalculation(tEntity)), false)) { + if (hasDimensionalTeleportCapability() && this.mTargetD != getBaseMetaTileEntity().getWorld().provider.dimensionId && (hasEgg || mFluid.isFluidEqual(Materials.Nitrogen.getPlasma(1)))) { + mFluid.amount = mFluid.amount - ((int) Math.min(1000, (tDistance * tDistance * weightCalculation(tEntity) / 8192))); + if (mFluid.amount < 1) { + mFluid = null; + } + } if (tEntity.ridingEntity != null) { tEntity.mountEntity(null); } @@ -336,6 +383,21 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { } @Override + public int getInputSlot() { + return 0; + } + + @Override + public int getOutputSlot() { + return 0; + } + + @Override + public int getCapacity() { + return 64000; + } + + @Override public boolean doesFillContainers() { return false; } @@ -352,7 +414,7 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { @Override public boolean canTankBeEmptied() { - return false; + return true; } @Override @@ -369,5 +431,4 @@ public class GT_MetaTileEntity_Teleporter extends GT_MetaTileEntity_BasicTank { public ITexture[][][] getTextureSet(ITexture[] aTextures) { return null; } - -} +}
\ No newline at end of file |