/** * 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; }
private static boolean isInRangeToRenderDist(EntityLivingBase entity, double distance) { double d1 = entity.getEntityBoundingBox().getAverageEdgeLength() * 64; return distance < d1 * d1; }
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; }
/** * 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; } }
/** * 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; }
@Override public <T extends Entity> List<T> getEntitiesWithinAABB(Class<? extends T> entityClass, AxisAlignedBB axisAlignedBB) { axisAlignedBB.getAverageEdgeLength(); return this.getCartWorld().getEntitiesWithinAABB(entityClass, axisAlignedBB); }
/** * 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; }
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; }
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)); } }
@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; } }
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; }
if (d3 < EntityAmphithere.this.getEntityBoundingBox().getAverageEdgeLength()) { this.action = EntityMoveHelper.Action.WAIT; EntityAmphithere.this.motionX *= 0.5D;
d3 = (double) MathHelper.sqrt(d3); if (d3 < EntityPixie.this.getEntityBoundingBox().getAverageEdgeLength()) { this.action = EntityMoveHelper.Action.WAIT; EntityPixie.this.motionX *= 0.5D;
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; } } } } }
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; } } } } }
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); //} }
if(this.attackDecision && this.getAttackTarget() != null && this.getDistance(this.getAttackTarget()) > Math.min(this.getEntityBoundingBox().getAverageEdgeLength() * 5, 25) && !this.isChild()){ this.attackDecision = false;
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);