48 lines
1.6 KiB
Java
48 lines
1.6 KiB
Java
package techreborn.blocks;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
import net.minecraft.block.material.Material;
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
import net.minecraft.util.IIcon;
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
public class BlockWoodenshelf extends BlockMachineBase {
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconFront;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconTop;
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
private IIcon iconBottom;
|
|
|
|
public BlockWoodenshelf(Material material) {
|
|
super(material);
|
|
setBlockName("techreborn.woodenshelf");
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void registerBlockIcons(IIconRegister icon) {
|
|
this.blockIcon = icon.registerIcon("techreborn:machine/wood_shelf_side");
|
|
this.iconFront = icon.registerIcon("techreborn:machine/wood_shelf_empty");
|
|
this.iconTop = icon.registerIcon("techreborn:machine/wood_shelf_side");
|
|
this.iconBottom = icon.registerIcon("techreborn:machine/wood_shelf_side");
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) {
|
|
int metadata = getTileRotation(blockAccess, x, y, z);
|
|
if (side == metadata && blockAccess.getBlockMetadata(x, y, z) == 1) {
|
|
return this.iconFront;
|
|
}
|
|
return metadata == 0 && side == 3 ? this.iconFront
|
|
: side == 1 ? this.iconTop :
|
|
side == 0 ? this.iconBottom : (side == 0 ? this.iconTop
|
|
: (side == metadata ? this.iconFront : this.blockIcon));
|
|
}
|
|
|
|
}
|