diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-09-15 00:47:45 +1000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2018-09-15 00:47:45 +1000 |
commit | 26f4a010b9caa2d892f7b7f42bd4eafb313082aa (patch) | |
tree | 420e9669981c5f4efa74484d5cac3f9b9de32478 /src/Java/gtPlusPlus/core/tileentities/general | |
parent | 678a32be304bcffe457cf869ba6c5d57bdc1b2e1 (diff) | |
download | GT5-Unofficial-26f4a010b9caa2d892f7b7f42bd4eafb313082aa.tar.gz GT5-Unofficial-26f4a010b9caa2d892f7b7f42bd4eafb313082aa.tar.bz2 GT5-Unofficial-26f4a010b9caa2d892f7b7f42bd4eafb313082aa.zip |
+ Added custom doors.
+ Added new Rocket Fuels and various chemical compounds to produce them.
+ Added an ASM fix that removes Diesel and EIO/GC Rocket Fuel from GC and allows use of all 4 GT++ fuels instead.
% Reworked Rocket Engine generators, to now use new fuels and produce heavy pollution.
$ Fixed bug that could corrupt the Fluid Registry.
Diffstat (limited to 'src/Java/gtPlusPlus/core/tileentities/general')
-rw-r--r-- | src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java new file mode 100644 index 0000000000..513435212d --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/general/TileEntityPlayerDoorBase.java @@ -0,0 +1,87 @@ +package gtPlusPlus.core.tileentities.general; + +import gtPlusPlus.core.block.ModBlocks; +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + +public class TileEntityPlayerDoorBase extends TileEntity { + + private boolean mIsOpen = false; + private short mMeta = 0; + private long mTickCounter = 0; + private final Block mBlockType; + + public TileEntityPlayerDoorBase(Block aBlock, int meta){ + mMeta = (short) meta; + mBlockType = aBlock; + } + + @Override + public void readFromNBT(NBTTagCompound aNBT) { + super.readFromNBT(aNBT); + this.mIsOpen = aNBT.getBoolean("mIsOpen"); + } + + @Override + public void writeToNBT(NBTTagCompound aNBT) { + super.writeToNBT(aNBT); + aNBT.setBoolean("mIsOpen", mIsOpen); + } + + @Override + public void updateEntity() { + super.updateEntity(); + mTickCounter++; + if (mTickCounter % 10 == 0) { + if (checkForPlayers(this.getWorldObj())) { + if (this.mIsOpen) { + this.getWorldObj().setBlock(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), this.getClosedMeta(), 3); + this.mIsOpen = false; + } + else { + this.getWorldObj().setBlock(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), this.getOpenMeta(), 3); + this.mIsOpen = true; + } + } + } + } + + @Override + public int getBlockMetadata() { + return this.mMeta; + } + + @Override + public Block getBlockType() { + return mBlockType; + } + + @Override + public boolean canUpdate() { + return true; + } + + private boolean checkForPlayers(World aWorld) { + int x = 0, y = 0, z = 0; + x = this.xCoord; + y = this.yCoord; + z = this.zCoord; + EntityPlayer aPlayer = aWorld.getClosestPlayer(x, y, z, 8D); + if (aPlayer != null) { + return true; + } + return false; + } + + private short getClosedMeta() { + return 0; + } + + private short getOpenMeta() { + return 1; + } + +} |