net.minecraft.util.math.MathHelper.floor_float()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中net.minecraft.util.math.MathHelper.floor_float()方法的一些代码示例,展示了MathHelper.floor_float()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MathHelper.floor_float()方法的具体详情如下:
包路径:net.minecraft.util.math.MathHelper
类名称:MathHelper
方法名:floor_float

MathHelper.floor_float介绍

暂无

代码示例

代码示例来源:origin: squeek502/VeganOption

@Override
public int getComparatorInputOverride(IBlockState blockState, World world, BlockPos pos)
{
  return MathHelper.floor_float(getRettingPercent(world, pos) * MiscHelper.MAX_REDSTONE_SIGNAL_STRENGTH);
}

代码示例来源:origin: squeek502/VeganOption

public int getComparatorSignalStrength()
{
  if (isComposting())
    return Math.max(0, MathHelper.floor_float(getCompostTemperature() / MAX_COMPOST_TEMPERATURE * MiscHelper.MAX_REDSTONE_SIGNAL_STRENGTH));
  else
    return 0;
}

代码示例来源:origin: ata4/dragon-mounts

/**
   * Returns a point that the entity can safely move to
   */
  private PathPoint getSafePoint(Entity entityIn, int x, int y, int z) {
    BlockPos pos = new BlockPos(x, y, z);
    
    entitySizeX = MathHelper.floor_float(entityIn.width + 1);
    entitySizeY = MathHelper.floor_float(entityIn.height + 1);
    entitySizeZ = MathHelper.floor_float(entityIn.width + 1);

    for (int ix = 0; ix < entitySizeX; ++ix) {
      for (int iy = 0; iy < entitySizeY; ++iy) {
        for (int iz = 0; iz < entitySizeZ; ++iz) {
          IBlockState blockState = blockaccess.getBlockState(pos.add(ix, iy, iz));
          if (blockState.getMaterial() != Material.AIR) {
            return null;
          }
        }
      }
    }

    return openPoint(x, y, z);
  }
}

代码示例来源:origin: joshiejack/Mariculture

/** Returns if the entity is covered in enough water
 * @param entity    the entity
 * @return if it's considered as in water */
public static boolean isInWater(Entity entity) {
  double eyes = entity.posY + (double)entity.getEyeHeight() - 0.65;
  int i = MathHelper.floor_double(entity.posX);
  int j = MathHelper.floor_float(MathHelper.floor_double(eyes));
  int k = MathHelper.floor_double(entity.posZ);
  BlockPos pos = new BlockPos(i, j, k);
  IBlockState state = entity.worldObj.getBlockState(pos);
  Block block = state.getBlock();
  if (state.getMaterial() == Material.WATER) {
    double filled = 1.0f; //If it's not a liquid assume it's a solid block
    if (block instanceof IFluidBlock) {
      filled = ((IFluidBlock)block).getFilledPercentage(entity.worldObj, pos);
    } else if (block instanceof BlockLiquid) {
      filled = BlockLiquid.getLiquidHeightPercent(block.getMetaFromState(state));
    }
    if (filled < 0) {
      filled *= -1;
      return eyes > pos.getY() + 1 + (1 - filled);
    } else {
      return eyes < pos.getY() + 1 + filled;
    }
  } else return false;
}

相关文章