我正在做一个简单的 Minecraft mod,但我对自定义玻璃块有问题:
https://1drv.ms/u/s!AqlbJB4d16OZu0TtNAG68on1C3EN?e=Fl9Ecv
玻璃块下方和玻璃块后面可见。我该如何解决它?
如果下一个块之间有空格是可见的: https://1drv.ms/u/s!AqlbJB4d16OZu0X-Wjd-hx3_wGEF?e=LQoAao
public class HardGlass extends BlockBase
{
public HardGlass(String name, Material material)
{
super(name, material);
setSoundType(SoundType.GLASS);
setHardness(600.0F);
setResistance(100.0F);
setHarvestLevel("pixaxe",3);
setLightOpacity(1);
}
@SideOnly(Side.CLIENT)
public BlockRenderLayer getBlockLayer()
{
return BlockRenderLayer.CUTOUT;
}
public boolean isFullCube(IBlockState state)
{
return true;
}
}
为 isFullCube 返回 false,以便 MC 渲染它周围的块。
添加它解决了问题,我仍然可以在上面开门;)
@Override
public boolean isOpaqueCube(IBlockState state) {
return false;
}