summaryrefslogtreecommitdiff
path: root/common/darkknight/jewelrycraft/block/BlockShadow.java
blob: 1e58d549e93fe4f95521074daf7872e0ebb3dd83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
package darkknight.jewelrycraft.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 BlockContainer
{
    private Icon[] iconArray;

    public BlockShadow(int par1)
    {
        super(par1, 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)
    {
        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 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 iBlockAccess, int par2, int par3, int par4, int par5)
    {
        return iBlockAccess.isAirBlock(par2, par3, par4)?true:iBlockAccess.isBlockNormalCube(par2, par3, par4)?false:(iBlockAccess.getBlockId(par2, par3, par4) == BlockList.shadowBlock.blockID)?false: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 this.iconArray[par2];
    }
}