diff options
| author | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2014-04-14 12:03:51 +0300 |
|---|---|---|
| committer | OnyxDarkKnight <sor1n.iliutza16@gmail.com> | 2014-04-14 12:03:51 +0300 |
| commit | 4ea6a1052438ef1d8d42057d2a71755383166227 (patch) | |
| tree | 94def1bf66c59583d8e8aa7e3d1117a6f5b56b62 /eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java | |
| parent | 1a692ab45df3d88a6cc247cc9f4c0a41c7715264 (diff) | |
More updating
Diffstat (limited to 'eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java')
| -rw-r--r-- | eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java new file mode 100644 index 0000000..77b2051 --- /dev/null +++ b/eclipse/Jewelrycraft/common/darkknight/jewelrycraft/block/BlockShadow.java @@ -0,0 +1,113 @@ +package darkknight.jewelrycraft.block; + +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.init.Blocks; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Facing; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow; + +public class BlockShadow extends BlockContainer +{ + private IIcon[] iconArray; + + public BlockShadow() + { + super(Material.iron); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public int getRenderBlockPass() + { + return 1; + } + + public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) + { + return true; + } + + public boolean isOpaqueCube() + { + return false; + } + + public boolean renderAsNormalBlock() + { + return false; + } + + public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side) + { + return false; + } + + public static boolean isNormalCube(int par0) + { + return true; + } + + @Override + public TileEntity createNewTileEntity(World world, int var2) + { + return new TileEntityBlockShadow(); + } + + public void registerIcons(IIconRegister par1IconRegister) + { + this.iconArray = new IIcon[16]; + + for (int i = 0; i < this.iconArray.length; ++i) + { + this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i)); + } + } + + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) + { + if(world.getBlockMetadata(x, y, z) == 15) return null; + return super.getCollisionBoundingBoxFromPool(world, x, y, z); + } + + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) + { + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + } + + public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) + { + Block block = p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_); + + if (this == BlockList.shadowBlock) + { + if (p_149646_1_.getBlockMetadata(p_149646_2_, p_149646_3_, p_149646_4_) != p_149646_1_.getBlockMetadata(p_149646_2_ - Facing.offsetsXForSide[p_149646_5_], p_149646_3_ - Facing.offsetsYForSide[p_149646_5_], p_149646_4_ - Facing.offsetsZForSide[p_149646_5_])) + { + return true; + } + + if (block == this) + { + return false; + } + } + + return block == this ? false : super.shouldSideBeRendered(p_149646_1_, p_149646_2_, p_149646_3_, p_149646_4_, p_149646_5_); + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World world, int x, int y, int z, int meta) + { + return world.getBlockMetadata(x, y, z); + } +} |
