From 4d0e0e8de72bda8543a888082a93b1e56f13856b Mon Sep 17 00:00:00 2001 From: OnyxDarkKnight Date: Sat, 8 Feb 2014 03:03:22 +0200 Subject: Added a new block and implemented an on/off "switch" for the rings that give buffs, also working on balancing the rings --- .../darkknight/jewelrycraft/block/BlockShadow.java | 87 ++++++++++++++++++---- 1 file changed, 74 insertions(+), 13 deletions(-) (limited to 'common/darkknight/jewelrycraft/block/BlockShadow.java') diff --git a/common/darkknight/jewelrycraft/block/BlockShadow.java b/common/darkknight/jewelrycraft/block/BlockShadow.java index ea811ee..9aeb82a 100644 --- a/common/darkknight/jewelrycraft/block/BlockShadow.java +++ b/common/darkknight/jewelrycraft/block/BlockShadow.java @@ -1,39 +1,100 @@ package darkknight.jewelrycraft.block; -import net.minecraft.block.Block; +import darkknight.jewelrycraft.tileentity.TileEntityBlockShadow; +import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IconRegister; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.Icon; +import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.ForgeDirection; -public class BlockShadow extends Block +public class BlockShadow extends BlockContainer { - protected BlockShadow(int par1) + private Icon[] iconArray; + + public BlockShadow(int par1) { - super(par1, Material.air); + super(par1, Material.iron); + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int i) + public int getRenderBlockPass() { - return null; + return 1; } - - public boolean isCollidable() + + public boolean isBeaconBase(World worldObj, int x, int y, int z, int beaconX, int beaconY, int beaconZ) { - return false; + 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 true; + } + + public static boolean isNormalCube(int par0) + { + return true; + } + + @Override + public TileEntity createNewTileEntity(World world) + { + return new TileEntityBlockShadow(); + } + + public void registerIcons(IconRegister par1IconRegister) + { + this.iconArray = new Icon[16]; + + for (int i = 0; i < this.iconArray.length; ++i) + { + this.iconArray[i] = par1IconRegister.registerIcon(this.getTextureName() + (15 - i)); + } + } - public int getRenderType() + 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 par1IBlockAccess, int par2, int par3, int par4, int par5) + { + return true; + } + + public boolean hasComparatorInputOverride() + { + return true; + } + + public int getComparatorInputOverride(World world, int x, int y, int z, int meta) + { + return world.getBlockMetadata(x, y, z); + } + + public Icon getIcon(int par1, int par2) { - return -1; + return this.iconArray[par2]; } } -- cgit v1.2.3