mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 08:54:12 +00:00
58 lines
1.6 KiB
Java
58 lines
1.6 KiB
Java
package tconstruct.blocks;
|
|||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
import net.minecraft.block.Block;
|
||
|
|
import net.minecraft.block.material.Material;
|
||
|
|
import net.minecraft.entity.Entity;
|
||
|
|
import net.minecraft.util.AxisAlignedBB;
|
||
|
|
import net.minecraft.world.IBlockAccess;
|
||
|
|
import net.minecraft.world.World;
|
||
|
|
|
||
|
|
public class SlabBase extends Block
|
||
|
|
{
|
||
|
|
public SlabBase(int id, Material material)
|
||
|
|
{
|
||
|
|
super(id, material);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity)
|
||
|
|
{
|
||
|
|
setBlockBoundsBasedOnState(world, x, y, z);
|
||
|
|
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, entity);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setBlockBoundsForItemRender ()
|
||
|
|
{
|
||
|
|
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||
|
|
}
|
||
|
|
|
||
|
|
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||
|
|
{
|
||
|
|
int meta = world.getBlockMetadata(x, y, z) / 8;
|
||
|
|
float minY = meta == 1 ? 0.5F : 0.0F;
|
||
|
|
float maxY = meta == 1 ? 1.0F : 0.5F;
|
||
|
|
setBlockBounds(0.0F, minY, 0F, 1.0F, maxY, 1.0F);
|
||
|
|
}
|
||
|
|
|
||
|
|
public int onBlockPlaced (World par1World, int blockX, int blockY, int blockZ, int side, float clickX, float clickY, float clickZ, int metadata)
|
||
|
|
{
|
||
|
|
if (side == 1)
|
||
|
|
return metadata;
|
||
|
|
if (side == 0 || clickY >= 0.5F)
|
||
|
|
return metadata | 8;
|
||
|
|
|
||
|
|
return metadata;
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean isOpaqueCube ()
|
||
|
|
{
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
|
||
|
|
public boolean renderAsNormalBlock ()
|
||
|
|
{
|
||
|
|
return false;
|
||
|
|
}
|
||
|
|
}
|