2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
2.0 KiB
Java

package net.minecraft.block;
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.init.Blocks;
import net.minecraft.util.Facing;
import net.minecraft.world.IBlockAccess;
public class BlockBreakable extends Block
{
private boolean field_149996_a;
private String field_149995_b;
private static final String __OBFID = "CL_00000254";
protected BlockBreakable(String name, Material materialIn, boolean ignoreSimilarity)
{
super(materialIn);
this.field_149996_a = ignoreSimilarity;
this.field_149995_b = name;
}
/**
* Is this block (a) opaque and (b) a full 1m cube? This determines whether or not to render the shared face of two
* adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.
*/
public boolean isOpaqueCube()
{
return false;
}
/**
* Returns true if the given side of this block type should be rendered, if the adjacent block is at the given
* coordinates. Args: blockAccess, x, y, z, side
*/
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess worldIn, int x, int y, int z, int side)
{
Block block = worldIn.getBlock(x, y, z);
if (this == Blocks.glass || this == Blocks.stained_glass)
{
if (worldIn.getBlockMetadata(x, y, z) != worldIn.getBlockMetadata(x - Facing.offsetsXForSide[side], y - Facing.offsetsYForSide[side], z - Facing.offsetsZForSide[side]))
{
return true;
}
if (block == this)
{
return false;
}
}
return !this.field_149996_a && block == this ? false : super.shouldSideBeRendered(worldIn, x, y, z, side);
}
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister reg)
{
this.blockIcon = reg.registerIcon(this.field_149995_b);
}
}