示例#1
0
 @Override
 public boolean onItemUse(
     ItemStack itemstack,
     EntityPlayer entityplayer,
     World world,
     int x,
     int y,
     int z,
     int side,
     float hitX,
     float hitY,
     float hitZ) {
   if (!world.isRemote) {
     int dir = MathHelper.floor_double((double) (entityplayer.rotationYaw * 4F / 360F) + 0.5D) & 3;
   }
   return false;
 }
 @Override
 public void onBlockPlacedBy(
     World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack) {
   int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 2.5D) & 3;
   world.setBlockState(pos, getDefaultState().withProperty(FACING, EnumFacing.fromAngle(90 * l)));
 }