@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { if (shouldBlockRenderLowered(world, pos)) { return BOUNDING_BOX.expand(0, -0.05, 0); } return BOUNDING_BOX; }
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { if (shouldBlockRenderLowered(world, pos)) { return BOUNDING_BOX.expand(0, -0.05, 0); } return BOUNDING_BOX; }
@Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess world, BlockPos pos) { if (shouldBlockRenderLowered(world, pos)) { return BOUNDING_BOX.expand(0, -0.05, 0); } return BOUNDING_BOX; }
List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity(this, this.getEntityBoundingBox().expand(this.motionX, this.motionY, this.motionZ).grow(1.0D)); double d0 = 0.0D; boolean flag = false;
public List<PhysicsWrapperEntity> getNearbyPhysObjects(AxisAlignedBB toCheck) { ArrayList<PhysicsWrapperEntity> ships = new ArrayList<PhysicsWrapperEntity>(); AxisAlignedBB expandedCheck = toCheck.expand(6, 6, 6); for (PhysicsWrapperEntity wrapper : physicsEntities) { if (wrapper.wrapping.getCollisionBoundingBox().intersects(expandedCheck)) { ships.add(wrapper); } } return ships; }
private void updateCollection() { //expand only goes ONE direction. so expand(3...) goes 3 in + x, but not both ways. for full boc centered at this..!! we go + and - BlockPos center = this.getTargetCenter(); AxisAlignedBB region = new AxisAlignedBB(center).expand(size, VRADIUS, size).expand(-1 * size, -1 * VRADIUS, -1 * size);//expandXyz List<EntityItem> items = getWorld().getEntitiesWithinAABB(EntityItem.class, region); if (items == null) { return; } for (EntityItem itemOnGround : items) { processItemOnGround(itemOnGround); } }
private static Optional<Tuple<Double, Entity>> getClosestCollidedEntity(Entity excludedEntity, Vec3d playerEyesPos, Vec3d lookVector, Vec3d endVector) { Minecraft mc = Minecraft.getMinecraft(); //noinspection ConstantConditions List<Entity> possibleHitEntities = mc.world.getEntitiesWithinAABBExcludingEntity(mc.getRenderViewEntity(), mc.getRenderViewEntity().getEntityBoundingBox().expand(lookVector.x * MAX_RANGE, lookVector.y * MAX_RANGE, lookVector.z * MAX_RANGE) .grow(1, 1, 1)); return possibleHitEntities.stream().filter(e -> e != excludedEntity && e.canBeCollidedWith()) .map(e -> new Tuple<>(getDistanceToCollidedEntity(e, playerEyesPos, endVector), e)).filter(t -> t.getFirst() < Double.MAX_VALUE) .sorted(Comparator.comparing(Tuple::getFirst)).findFirst(); }
@Override protected double getAttackReachSqr(EntityLivingBase attackTarget) { if (attackTarget.getEntityBoundingBox().intersects(this.dinosaur.getEntityBoundingBox().expand(1.3, 1.3, 1.3))) { return 1024.0; } double grownWidth = this.attacker.width + 1.0; return grownWidth * grownWidth; } }
@Override public void onUserHurt(@Nonnull EntityLivingBase user, @Nonnull Entity attacker, int level) { if (user instanceof EntityPlayer && attacker instanceof EntityLivingBase && !EnchantmentHelper.getEnchantedItem(this, user).isEmpty()) { if (level > getMaxLevel()) { for (Entity e : user.world.getEntitiesWithinAABBExcludingEntity(user, user.getEntityBoundingBox().expand(level * 8, level * 4, level * 8))) { RandomTeleportUtil.teleportEntity(e.world, e, false, false, 16 * level); } } else if (user.getRNG().nextFloat() < (.5f + .1f * level)) { RandomTeleportUtil.teleportEntity(attacker.world, attacker, false, attacker instanceof EntityPlayer || user.getRNG().nextFloat() < .75f, 16 * level); } } }
private static boolean spawnGoddess(World world, double x, double y, double z, boolean flower, boolean move) { List<EntityNPCGoddess> npcs = world.getEntitiesWithinAABB(EntityNPCGoddess.class, new AxisAlignedBB(x - 0.5F, y - 0.5F, z - 0.5F, x + 0.5F, y + 0.5F, z + 0.5F).expand(32D, 32D, 32D)); boolean newGoddess = npcs.size() < 1; EntityNPCGoddess goddess = !newGoddess ? npcs.get(0) : NPCHelper.getEntityForNPC(world, (NPC) HFNPCs.GODDESS); if (flower) goddess.setFlower(); if (move || (goddess.posX == 0 && goddess.posY == 0 && goddess.posZ == 0)) goddess.setPosition(x, y + 1, z); if (newGoddess) { world.spawnEntity(goddess); } return !newGoddess; }
@Override @SideOnly(Side.CLIENT) public AxisAlignedBB getRenderBoundingBox() { if (this.isSkeleton && this.entity != null) { return this.entity.getRenderBoundingBox().expand(3.0, 3.0, 3.0).offset(this.pos); } return super.getRenderBoundingBox(); }
@Override public void update() { if (!getWorld().isRemote && canUpdate()) { if (getWorld().rand.nextInt(100) == 0) { List entities = getWorld().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(pos, pos.up()).expand(3, 0, 3)); if (entities.isEmpty()) spawnUnit(); } } else { //getWorld().tickableTileEntities.remove(this); } }
private void beaconMonster() { if (!world.isRemote) { AxisAlignedBB axisalignedbb = (new AxisAlignedBB(posX, posY, posZ, posX + 1, posY + 1, posZ + 1)).grow(6).expand(0.0D, 0.0D, 0.0D); List<EntityLivingBase> moblist = world.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb); for (EntityLivingBase mob : moblist) { if (mob instanceof EntityZombie || mob instanceof EntitySkeleton) { mob.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 300, 1, true, true)); } } } }
@Override public void startExecuting() { lastExecuted = npc.ticksExisted; double dist = npc.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).getAttributeValue(); AxisAlignedBB bb = npc.getEntityBoundingBox().expand(dist, dist / 2, dist); List<NpcBase> potentialTargets = npc.world.getEntitiesWithinAABB(NpcBase.class, bb, selector); for (NpcBase npcBase : potentialTargets) { npcBase.addPotionEffect(new PotionEffect(effect)); } }
public Iterable<EntityLivingBase> getVictims() { return world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(center).grow(radius, 0, radius).expand(0, height, 0), (entity) -> entity != null && entity.isEntityAlive() && entity.canBeHitWithPotion() && !(entity instanceof EntityZachriel) && entity.getDistanceSq(center) < radius * radius); }
/** Returns the entities around this area **/ public static <T extends Entity> List<T> getEntities(Class<? extends T> t, World world, BlockPos pos, double size, double ySize) { return world.getEntitiesWithinAABB(t, new AxisAlignedBB(pos.getX() - 0.5F, pos.getY() - 0.5F, pos.getZ() - 0.5F, pos.getX() + 0.5F, pos.getY() + 0.5F, pos.getZ() + 0.5F).expand(size, ySize, size)); } }
private void renderBoundingBox(BlockPos pos, BlockPos min, BlockPos max, float r, float g, float b, float expansion) { GlStateManager.disableLighting(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); AxisAlignedBB bb = new AxisAlignedBB(min, max.add(1, 1, 1)); if (expansion != 0.f) { bb = bb.expand(expansion, expansion, expansion); } bb = bb.offset(-pos.getX(), -pos.getY(), -pos.getZ()); RenderTools.drawOutlinedBoundingBox2(bb, 1.f, 1.f, 1.f, 0.0625f); GlStateManager.enableLighting(); }
private void renderBoundingBox(BlockPos pos, BlockPos min, BlockPos max, float r, float g, float b, float expansion) { GlStateManager.disableLighting(); GlStateManager.color(1.f, 1.f, 1.f, 1.f); AxisAlignedBB bb = new AxisAlignedBB(min.getX(), min.getY(), min.getZ(), max.getX() + 1, max.getY() + 1, max.getZ() + 1); if (expansion != 0.f) { bb = bb.expand(expansion, expansion, expansion); } bb = bb.offset(-pos.getX(), -pos.getY(), -pos.getZ()); RenderTools.drawOutlinedBoundingBox2(bb, 1.f, 1.f, 1.f, 0.0625f); GlStateManager.enableLighting(); }