本文整理汇总了Java中net.minecraft.tileentity.TileEntityPiston.getFacing方法的典型用法代码示例。如果您正苦于以下问题:Java TileEntityPiston.getFacing方法的具体用法?Java TileEntityPiston.getFacing怎么用?Java TileEntityPiston.getFacing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.tileentity.TileEntityPiston
的用法示例。
在下文中一共展示了TileEntityPiston.getFacing方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setBlockBoundsBasedOnState
import net.minecraft.tileentity.TileEntityPiston; //导入方法依赖的package包/类
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
TileEntityPiston tileentitypiston = this.getTileEntity(worldIn, pos);
if (tileentitypiston != null)
{
IBlockState iblockstate = tileentitypiston.getPistonState();
Block block = iblockstate.getBlock();
if (block == this || block.getMaterial() == Material.air)
{
return;
}
float f = tileentitypiston.getProgress(0.0F);
if (tileentitypiston.isExtending())
{
f = 1.0F - f;
}
block.setBlockBoundsBasedOnState(worldIn, pos);
if (block == Blocks.piston || block == Blocks.sticky_piston)
{
f = 0.0F;
}
EnumFacing enumfacing = tileentitypiston.getFacing();
this.minX = block.getBlockBoundsMinX() - (double)((float)enumfacing.getFrontOffsetX() * f);
this.minY = block.getBlockBoundsMinY() - (double)((float)enumfacing.getFrontOffsetY() * f);
this.minZ = block.getBlockBoundsMinZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
this.maxX = block.getBlockBoundsMaxX() - (double)((float)enumfacing.getFrontOffsetX() * f);
this.maxY = block.getBlockBoundsMaxY() - (double)((float)enumfacing.getFrontOffsetY() * f);
this.maxZ = block.getBlockBoundsMaxZ() - (double)((float)enumfacing.getFrontOffsetZ() * f);
}
}