net.minecraft.util.math.AxisAlignedBB类的使用及代码示例

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

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

AxisAlignedBB介绍

暂无

代码示例

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

private int countEntitesAround( World world, BlockPos pos )
  {
    final AxisAlignedBB t = new AxisAlignedBB( pos ).grow( 8 );
    final List<Entity> list = world.getEntitiesWithinAABB( Entity.class, t );

    return list.size();
  }
}

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

@Nonnull
@Override
public AxisAlignedBB getBoundingBox(IBlockState state, @Nonnull IBlockAccess world, @Nonnull BlockPos pos) {
  return AABB.offset(state.getOffset(world, pos));
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@SuppressWarnings( "deprecation" )
@Override
public void addCollisionBoxToList( final IBlockState state, final World w, final BlockPos pos, final AxisAlignedBB bb, final List<AxisAlignedBB> out, @Nullable final Entity e, boolean p_185477_7_ )
{
  final ICustomCollision collisionHandler = this.getCustomCollision( w, pos );
  if( collisionHandler != null && bb != null )
  {
    final List<AxisAlignedBB> tmp = new ArrayList<>();
    collisionHandler.addCollidingBlockToList( w, pos, bb, tmp, e );
    for( final AxisAlignedBB b : tmp )
    {
      final AxisAlignedBB offset = b.offset( pos.getX(), pos.getY(), pos.getZ() );
      if( bb.intersects( offset ) )
      {
        out.add( offset );
      }
    }
  }
  else
  {
    super.addCollisionBoxToList( state, w, pos, bb, out, e, p_185477_7_ );
  }
}

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

@Override
public AxisAlignedBB getWireframeAABB(World world, BlockPos pos) {
  return FULL_BLOCK_AABB.offset(pos).shrink(1.0/16.0);
}

代码示例来源:origin: SlimeKnights/TinkersConstruct

private List<Entity> getAoeEntities(EntityPlayer player, Entity target, TinkerToolEvent.ExtraBlockBreak event) {
 int width = (event.width - 1) / 2;
 int height = (event.width - 1) / 2;
 AxisAlignedBB box = new AxisAlignedBB(target.posX, target.posY, target.posZ, target.posX + 1.0D, target.posY + 1.0D, target.posZ + 1.0D).expand(width, height, width);
 return player.getEntityWorld().getEntitiesWithinAABBExcludingEntity(player, box);
}

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

@Override
public boolean bindTo(EntityPlayer player, ItemStack wand, BlockPos pos, EnumFacing side) {
  Vector3 thisVec = Vector3.fromTileEntityCenter(this);
  Vector3 blockVec = new Vector3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
  AxisAlignedBB axis = player.world.getBlockState(pos).getCollisionBoundingBox(player.world, pos);
  if(axis != null)
    axis = axis.offset(pos);
  else axis = new AxisAlignedBB(pos, pos.add(1, 1, 1));
  if(!blockVec.isInside(axis))
    blockVec = new Vector3(axis.minX + (axis.maxX - axis.minX) / 2, axis.minY + (axis.maxY - axis.minY) / 2, axis.minZ + (axis.maxZ - axis.minZ) / 2);
  Vector3 diffVec =  blockVec.subtract(thisVec);
  Vector3 diffVec2D = new Vector3(diffVec.x, diffVec.z, 0);
  Vector3 rotVec = new Vector3(0, 1, 0);
  double angle = rotVec.angle(diffVec2D) / Math.PI * 180.0;
  if(blockVec.x < thisVec.x)
    angle = -angle;
  rotationX = (float) angle + 90;
  rotVec = new Vector3(diffVec.x, 0, diffVec.z);
  angle = diffVec.angle(rotVec) * 180F / Math.PI;
  if(blockVec.y < thisVec.y)
    angle = -angle;
  rotationY = (float) angle;
  checkForReceiver();
  return true;
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

final AxisAlignedBB bb = new AxisAlignedBB( Math.min( vec3.x, vec31.x ), Math.min( vec3.y, vec31.y ), Math.min( vec3.z,
    vec31.z ), Math.max( vec3.x, vec31.x ), Math.max( vec3.y, vec31.y ), Math.max( vec3.z, vec31.z ) ).grow(
        16, 16, 16 );
        final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
        final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( vec3, vec31 );

代码示例来源: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: Vazkii/Botania

if(e instanceof EntityMagicLandmine) {
  BlockPos bpos = e.getPosition();
  AxisAlignedBB aabb = new AxisAlignedBB(bpos).offset(0, offY, 0).grow(2.5, 0, 2.5);

代码示例来源: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: Vazkii/Botania

@SubscribeEvent
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
  if(event.getResult() != Result.ALLOW && event.getEntityLiving() instanceof IMob) {
    AxisAlignedBB aabb = new AxisAlignedBB(event.getX() - RANGE, event.getY() - RANGE, event.getZ() - RANGE, event.getX() + RANGE, event.getY() + RANGE, event.getZ() + RANGE);
    for(EntityPlayer player : event.getWorld().playerEntities) {
      if(hasEffect(player) && player.getEntityBoundingBox().intersects(aabb)) {
        event.setResult(Result.DENY);
        return;
      }
    }
  }
}

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

private List<EntityPlayer> getPlayersWithinAABB() {
  List<EntityPlayer> players = new ArrayList<>();
  for (EntityPlayer player : world.playerEntities) {
    if (player.getEntityBoundingBox().intersects(new AxisAlignedBB(pos, pos.add(1, 1, 1)).grow(playerRange, playerRange, playerRange))) {
      players.add(player);
    }
  }
  return players;
}

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

List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().offset(motionX, motionY, motionZ).grow(1.0D));
double d0 = 0.0D;
for (int i = 0; i < list.size(); ++i)
      AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D);
      RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);

代码示例来源: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: 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: Vazkii/Botania

AxisAlignedBB aabb = ModBlocks.lightRelay.getBoundingBox(world.getBlockState(pos), world, pos).offset(pos);
float range = 0.5F;
List<EntityEnderPearl> enderPearls = world.getEntitiesWithinAABB(EntityEnderPearl.class, aabb.grow(range));
for(EntityEnderPearl pearl : enderPearls) {
  pearl.setPositionAndUpdate(

代码示例来源:origin: amadornes/MCMultiPart

@Override
public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity) {
  return anyMatch(world, pos, i -> i.getPart().isLadder(i.wrapAsNeeded(world), pos, i, entity) &&
      Optional.ofNullable(i.getPart().getCollisionBoundingBox(i.getPartWorld(), pos, i.getState()).offset(pos))
          .map(it -> it.intersects(entity.getEntityBoundingBox().grow(0.01 / 16F))).orElse(false));
}

代码示例来源: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;
      AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D);
      RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);

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

RayTraceResult rtr = player.getEntityBoundingBox().grow(0.25).calculateIntercept(origPos, newPos);
if(rtr != null)
  player.attackEntityFrom(DamageSource.causeMobDamage(this), 6);

代码示例来源:origin: raoulvdberge/refinedstorage

public static AdvancedRayTraceResult<RayTraceResult> rayTrace(BlockPos pos, Vec3d start, Vec3d end, AxisAlignedBB bounds, int subHit, CollisionGroup group) {
    RayTraceResult result = bounds.offset(pos).calculateIntercept(start, end);

    if (result == null) {
      return null;
    }

    result = new RayTraceResult(RayTraceResult.Type.BLOCK, result.hitVec, result.sideHit, pos);
    result.subHit = subHit;

    return new AdvancedRayTraceResult<>(group, bounds, result);
  }
}

相关文章