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

x33g5p2x  于11个月前 转载在 其他  
字(8.3k)|赞(0)|评价(0)|浏览(23)

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

AxisAlignedBB.getAverageEdgeLength介绍

暂无

代码示例

代码示例来源:origin: Vazkii/Botania

/**
 * Checks if the entity is in range to render.
 */
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance)
{
  double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
  if (Double.isNaN(d0))
  {
    d0 = 4.0D;
  }
  d0 = d0 * 64.0D;
  return distance < d0 * d0;
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

private static boolean isInRangeToRenderDist(EntityLivingBase entity, double distance) {
  double d1 = entity.getEntityBoundingBox().getAverageEdgeLength() * 64;
  return distance < d1 * d1;
}

代码示例来源:origin: SleepyTrousers/EnderIO

private boolean isClear(@Nonnull World w, @Nonnull IBlockState bs, @Nonnull Block block, @Nonnull BlockPos bp) {
 if (block.isAir(bs, w, bp)) {
  return true;
 }
 final AxisAlignedBB aabb = bs.getBoundingBox(w, bp);
 if (aabb.getAverageEdgeLength() < 0.7) {
  return true;
 }
 return block.getLightOpacity(bs, w, bp) < 2;
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

/**
   * Checks if the entity is in range to render.
   */
  @SideOnly(Side.CLIENT)
  public boolean isInRangeToRenderDist(double distance) {
    double d0 = this.getBoundingBox().getAverageEdgeLength();

    if (Double.isNaN(d0)) {
      d0 = 1.0D;
    }

    d0 = d0 * 64.0D * renderDistanceWeight;
    return distance < d0 * d0;
  }
}

代码示例来源:origin: ValkyrienWarfare/Valkyrien-Warfare-Revamped

/**
 * Checks if the entity is in range to render.
 */
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(double distance) {
  double d0 = this.getEntityBoundingBox().getAverageEdgeLength() * 4.0D;
  if (Double.isNaN(d0)) {
    d0 = 4.0D;
  }
  d0 = d0 * 64.0D;
  return distance < d0 * d0;
}

代码示例来源:origin: PrinceOfAmber/Cyclic

@Override
public <T extends Entity> List<T> getEntitiesWithinAABB(Class<? extends T> entityClass, AxisAlignedBB axisAlignedBB) {
 axisAlignedBB.getAverageEdgeLength();
 return this.getCartWorld().getEntitiesWithinAABB(entityClass, axisAlignedBB);
}

代码示例来源:origin: ldtteam/minecolonies

/**
 * Checks if the entity is in range to render by using the past in distance
 * and comparing it to its average edge. length * 64 * renderDistanceWeight
 * Args: distance.
 *
 * @param range the real range.
 * @return true or false.
 */
@Override
@SideOnly(Side.CLIENT)
public boolean isInRangeToRenderDist(final double range)
{
  double maxLength = this.getEntityBoundingBox().getAverageEdgeLength() * NUM_BOUNDING_BOX_EDGES;
  maxLength *= DISTANCE_FACTOR;
  return range < maxLength * maxLength;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

private boolean isBlockFullCube(BlockPos pos) {
  AxisAlignedBB axisalignedbb = world.getBlockState(pos).getCollisionBoundingBox(world, pos);
  return world.getBlockState(pos).getMaterial() != Material.SAND && axisalignedbb != Block.NULL_AABB && axisalignedbb.getAverageEdgeLength() >= 1.0D;
}

代码示例来源:origin: P3pp3rF1y/AncientWarfare2

public void updateRenderBoundingBox(EntityGate gate) {
  if (gate.getRenderBoundingBox().getAverageEdgeLength() == 0) {
    BlockPos min = BlockTools.getMin(gate.pos1, gate.pos2);
    BlockPos max = BlockTools.getMax(gate.pos1, gate.pos2);
    gate.setRenderBoundingBox(getRenderBoundingBox(gate, min, max));
  }
}

代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition

@SideOnly(Side.CLIENT)
  public boolean isInRangeToRenderDist(double p_70112_1_) {
    double d1 = this.getEntityBoundingBox().getAverageEdgeLength();
    d1 *= 64.0D * Entity.getRenderDistanceWeight();
    d1 += getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue();
    return p_70112_1_ < d1 * d1;
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

private boolean canTeleportTo(@Nonnull EntityPlayer player, @Nonnull TravelSource source, @Nonnull BlockPos bc, @Nonnull World w) {
 if (bc.getY() < 1) {
  return false;
 }
 if (source == TravelSource.STAFF_BLINK && !TeleportConfig.enableBlinkSolidBlocks.get()) {
  Vec3d start = Util.getEyePosition(player);
  Vec3d target = new Vec3d(bc.getX() + 0.5f, bc.getY() + 0.5f, bc.getZ() + 0.5f);
  if (!canBlinkTo(bc, w, start, target)) {
   return false;
  }
 }
 IBlockState bs = w.getBlockState(bc);
 Block block = bs.getBlock();
 if (block.isAir(bs, w, bc)) {
  return true;
 }
 final AxisAlignedBB aabb = bs.getBoundingBox(w, bc);
 return aabb.getAverageEdgeLength() < 0.7;
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

if (d3 < EntityAmphithere.this.getEntityBoundingBox().getAverageEdgeLength()) {
  this.action = EntityMoveHelper.Action.WAIT;
  EntityAmphithere.this.motionX *= 0.5D;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

d3 = (double) MathHelper.sqrt(d3);
if (d3 < EntityPixie.this.getEntityBoundingBox().getAverageEdgeLength()) {
  this.action = EntityMoveHelper.Action.WAIT;
  EntityPixie.this.motionX *= 0.5D;

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public void onUpdateMoveHelper() {
    if (this.action == EntityMoveHelper.Action.MOVE_TO) {
      double d0 = this.posX - EntityMyrmexRoyal.this.posX;
      double d1 = this.posY - EntityMyrmexRoyal.this.posY;
      double d2 = this.posZ - EntityMyrmexRoyal.this.posZ;
      double d3 = d0 * d0 + d1 * d1 + d2 * d2;
      d3 = (double) MathHelper.sqrt(d3);
      if (d3 < EntityMyrmexRoyal.this.getEntityBoundingBox().getAverageEdgeLength()) {
        this.action = EntityMoveHelper.Action.WAIT;
        EntityMyrmexRoyal.this.motionX *= 0.5D;
        EntityMyrmexRoyal.this.motionY *= 0.5D;
        EntityMyrmexRoyal.this.motionZ *= 0.5D;
      } else {
        EntityMyrmexRoyal.this.motionX += d0 / d3 * 0.15D * this.speed;
        EntityMyrmexRoyal.this.motionY += d1 / d3 * 0.15D * this.speed;
        EntityMyrmexRoyal.this.motionZ += d2 / d3 * 0.15D * this.speed;
        if (EntityMyrmexRoyal.this.getAttackTarget() == null) {
          EntityMyrmexRoyal.this.rotationYaw = -((float) MathHelper.atan2(EntityMyrmexRoyal.this.motionX, EntityMyrmexRoyal.this.motionZ)) * (180F / (float) Math.PI);
          EntityMyrmexRoyal.this.renderYawOffset = EntityMyrmexRoyal.this.rotationYaw;
        } else {
          double d4 = EntityMyrmexRoyal.this.getAttackTarget().posX - EntityMyrmexRoyal.this.posX;
          double d5 = EntityMyrmexRoyal.this.getAttackTarget().posZ - EntityMyrmexRoyal.this.posZ;
          EntityMyrmexRoyal.this.rotationYaw = -((float) MathHelper.atan2(d4, d5)) * (180F / (float) Math.PI);
          EntityMyrmexRoyal.this.renderYawOffset = EntityMyrmexRoyal.this.rotationYaw;
        }
      }
    }
  }
}

代码示例来源:origin: Silentine/GrimoireOfGaia

public void onUpdateMoveHelper() {
    if (this.action == EntityMoveHelper.Action.MOVE_TO) {
      double d0 = this.posX - EntityGaiaBanshee.this.posX;
      double d1 = this.posY - EntityGaiaBanshee.this.posY;
      double d2 = this.posZ - EntityGaiaBanshee.this.posZ;
      double d3 = d0 * d0 + d1 * d1 + d2 * d2;
      d3 = (double) MathHelper.sqrt(d3);
      if (d3 < EntityGaiaBanshee.this.getEntityBoundingBox().getAverageEdgeLength()) {
        this.action = EntityMoveHelper.Action.WAIT;
        EntityGaiaBanshee.this.motionX *= 0.5D;
        EntityGaiaBanshee.this.motionY *= 0.5D;
        EntityGaiaBanshee.this.motionZ *= 0.5D;
      } else {
        EntityGaiaBanshee.this.motionX += d0 / d3 * 0.05D * this.speed;
        EntityGaiaBanshee.this.motionY += d1 / d3 * 0.05D * this.speed;
        EntityGaiaBanshee.this.motionZ += d2 / d3 * 0.05D * this.speed;
        if (EntityGaiaBanshee.this.getAttackTarget() == null) {
          EntityGaiaBanshee.this.rotationYaw = -((float) MathHelper.atan2(EntityGaiaBanshee.this.motionX, EntityGaiaBanshee.this.motionZ)) * (180F / (float) Math.PI);
          EntityGaiaBanshee.this.renderYawOffset = EntityGaiaBanshee.this.rotationYaw;
        } else {
          double d4 = EntityGaiaBanshee.this.getAttackTarget().posX - EntityGaiaBanshee.this.posX;
          double d5 = EntityGaiaBanshee.this.getAttackTarget().posZ - EntityGaiaBanshee.this.posZ;
          EntityGaiaBanshee.this.rotationYaw = -((float) MathHelper.atan2(d4, d5)) * (180F / (float) Math.PI);
          EntityGaiaBanshee.this.renderYawOffset = EntityGaiaBanshee.this.rotationYaw;
        }
      }
    }
  }
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

public void updateCheckPlayer() {
  double checklength = this.getEntityBoundingBox().getAverageEdgeLength() * 3;
  EntityPlayer player = world.getClosestPlayerToEntity(this, checklength);
  if (!this.isTamed() && this.isSleeping()) {
    if (player != null && !this.isOwner(player) && !player.capabilities.isCreativeMode) {
      this.setSleeping(false);
      this.setSitting(false);
      this.setAttackTarget(player);
    }
  }
  EntityPlayer player1 = world.getClosestPlayerToEntity(this, (this.getRenderSize() / 2) + 15);
  //if (player1 != null) {
  //	player1.addStat(ModAchievements.dragonEncounter, 1);
  //}
}

代码示例来源:origin: Alex-the-666/Ice_and_Fire

if(this.attackDecision && this.getAttackTarget() != null && this.getDistance(this.getAttackTarget()) > Math.min(this.getEntityBoundingBox().getAverageEdgeLength() * 5, 25) && !this.isChild()){
  this.attackDecision = false;

代码示例来源:origin: SleepyTrousers/EnderIO

if (NullHelper.untrust(bb) == null || bb.getAverageEdgeLength() < .2) {
 float radius = e.width / 2.0F;
 bb = new AxisAlignedBB(-radius, 0, -radius, radius, e.height, radius).offset(e.posX, e.posY, e.posZ);

相关文章