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

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

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

AxisAlignedBB.expand介绍

暂无

代码示例

代码示例来源:origin: blay09/CookingForBlockheads

@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;
}

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

/**
 * Fill the list of the item positions to gather.
 */
public void fillItemsList()
{
  searchForItems(worker.getEntityBoundingBox()
           .expand(RANGE_HORIZONTAL_PICKUP, RANGE_VERTICAL_PICKUP, RANGE_HORIZONTAL_PICKUP)
           .expand(-RANGE_HORIZONTAL_PICKUP, -RANGE_VERTICAL_PICKUP, -RANGE_HORIZONTAL_PICKUP));
}

代码示例来源:origin: blay09/CookingForBlockheads

@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;
}

代码示例来源:origin: blay09/CookingForBlockheads

@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;
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

@Nonnull
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
  AxisAlignedBB axisAlignedBB = new AxisAlignedBB(pos, pos.add(1, 1, 1));
  if (side == 1 || side == 2) {
    return axisAlignedBB.expand(0, flags.size(), 0);
  }
  return axisAlignedBB.expand(flags.size(), 0, 0);
}

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

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;

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

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;
}

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

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);
 }
}

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

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();
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@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;
  }
}

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

@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);
  }
 }
}

代码示例来源:origin: PenguinSquad/Harvest-Festival

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;
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@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();
}

代码示例来源:origin: Mine-and-blade-admin/Battlegear2

@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);
  }
}

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

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));
      }
    }
  }
}

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

@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));
  }
}

代码示例来源:origin: TeamWizardry/Wizardry

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);
}

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

/** 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));
  }
}

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

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();
}

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

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();
}

相关文章