net.minecraft.entity.Entity.canBeCollidedWith()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(182)

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

Entity.canBeCollidedWith介绍

暂无

代码示例

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

@Override
  public boolean apply(@Nullable Entity input) {
    return input!=null && input.canBeCollidedWith();
  }
}, EntitySelectors.NOT_SPECTATING));

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

public boolean apply(@Nullable Entity p_apply_1_) {
  return p_apply_1_ != null && p_apply_1_.canBeCollidedWith();
}

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

if (entity1.canBeCollidedWith())

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

if (entity1.canBeCollidedWith())

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

public boolean apply(@Nullable Entity entity) {
    return entity != null && entity.canBeCollidedWith() && entity instanceof EntityLivingBase && !entity.isEntityEqual(dragon) && !entity.isOnSameTeam(dragon) &&  (!(entity instanceof IDeadMob) || !((IDeadMob) entity).isMobDead());
  }
}));

代码示例来源: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: Alex-the-666/Ice_and_Fire

public boolean apply(@Nullable Entity entity) {
    boolean blindness = entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS) || (entity instanceof IBlacklistedFromStatues && !((IBlacklistedFromStatues) entity).canBeTurnedToStone());
    return entity != null && entity.canBeCollidedWith() && !blindness && (entity instanceof EntityPlayer || (entity instanceof EntityLiving && EntityPropertiesHandler.INSTANCE.getProperties(entity, StoneEntityProperties.class) != null && !EntityPropertiesHandler.INSTANCE.getProperties(entity, StoneEntityProperties.class).isStone));
  }
}));

代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation

getEntityBoundingBox().grow(motionX, motionY, motionZ));
for (Entity entity : list) {
  if (entity.canBeCollidedWith() && motionY < -1.0F) {
    entity.attackEntityFrom(DamageSource.FALLING_BLOCK, 3.0F);

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

if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || pickupDelay == 0)) {
  float f = 1.0F;
  AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(f);

代码示例来源:origin: MightyPirates/TIS-3D

@Nullable
private RayTraceResult checkEntityCollision(final World world, final Vec3d start, final Vec3d target) {
  RayTraceResult entityHit = null;
  double bestSqrDistance = Double.POSITIVE_INFINITY;
  final List<Entity> collisions = world.getEntitiesWithinAABBExcludingEntity(this, getEntityBoundingBox().addCoord(motionX, motionY, motionZ));
  for (final Entity entity : collisions) {
    if (entity.canBeCollidedWith()) {
      final AxisAlignedBB entityBounds = entity.getEntityBoundingBox();
      final RayTraceResult hit = entityBounds.calculateIntercept(start, target);
      if (hit != null) {
        final double sqrDistance = start.squareDistanceTo(hit.hitVec);
        if (sqrDistance < bestSqrDistance) {
          hit.entityHit = entity;
          hit.typeOfHit = RayTraceResult.Type.ENTITY;
          entityHit = hit;
          bestSqrDistance = sqrDistance;
        }
      }
    }
  }
  return entityHit;
}

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

@SideOnly(Side.CLIENT)
private Optional<RayTraceResult> getMouseOverExtended(float reach) {
  RayTraceResult ret = null;
  Minecraft mc = Minecraft.getMinecraft();
  Entity renderViewEntity = mc.getRenderViewEntity();
  if (renderViewEntity != null && mc.world != null) {
    mc.mcProfiler.startSection("pick");
    double d0 = reach;
    ret = renderViewEntity.rayTrace(d0, 0);
    Vec3d positionEyes = renderViewEntity.getPositionEyes(0);
    double calcDist = d0;
    if (ret != null) {
      calcDist = ret.hitVec.distanceTo(positionEyes);
    }
    Vec3d vec3d1 = renderViewEntity.getLook(1.0F);
    Vec3d vec3d2 = positionEyes.addVector(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0);
    List<Entity> list = mc.world.getEntitiesInAABBexcluding(renderViewEntity,
        renderViewEntity.getEntityBoundingBox().expand(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0).grow(1.0D, 1.0D, 1.0D),
        Predicates.and(EntitySelectors.NOT_SPECTATING, e -> e != null && e.canBeCollidedWith()));
    ret = getEntityHit(ret, renderViewEntity, positionEyes, calcDist, vec3d2, list);
  }
  return Optional.ofNullable(ret);
}

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

Vec3d endVec = new Vec3d(tx, ty, tz);
for (Entity ent : allEntities) {
  if (ent.canBeCollidedWith() && !excluded.contains(ent)) {
    AxisAlignedBB entityBb = ent.getEntityBoundingBox();
    if (entityBb != null) {

代码示例来源:origin: sinkillerj/ProjectE

if (e.canBeCollidedWith())

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

List<Entity> entitiesPossiblyHitByVector = world.getEntitiesWithinAABBExcludingEntity(player, player.getEntityBoundingBox().expand(var25.x * reachLength, var25.y * reachLength, var25.z * reachLength).expand(var27, var27, var27));
for (Entity testEntity : entitiesPossiblyHitByVector) {
  if (testEntity.canBeCollidedWith()) {
    float bbExpansionSize = testEntity.getCollisionBorderSize();
    AxisAlignedBB entityBB = testEntity.getEntityBoundingBox().expand(bbExpansionSize, bbExpansionSize, bbExpansionSize);

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

if(entity.canBeCollidedWith()) {
  float collisionBorderSize = entity.getCollisionBorderSize();
  AxisAlignedBB hitbox = entity.getEntityBoundingBox().grow(collisionBorderSize, collisionBorderSize, collisionBorderSize);

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

Entity entity = (Entity) aList;
if (entity.canBeCollidedWith()) {
  float f2 = entity.getCollisionBorderSize();
  AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().expand((double) f2, (double) f2, (double) f2);

代码示例来源:origin: SquidDev-CC/plethora

if (other.canBeCollidedWith() && (other != shooter || ticksExisted >= 5) && other instanceof EntityLivingBase) {
  if (
    other instanceof EntityPlayer && shooter instanceof EntityPlayer &&

代码示例来源:origin: jabelar/ExampleMod-1.12

if (entity.canBeCollidedWith())

代码示例来源:origin: OpenModularTurretsTeam/OpenModularTurrets

if (entity.canBeCollidedWith()) {
  this.onHitEntity(entity);

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

Entity entity1 = (Entity) aList;
if (entity1 != null && entity1.canBeCollidedWith() && !entity1.isDead && entity1 instanceof EntityLivingBase && ((EntityLivingBase) entity1).deathTime == 0) {
  float f1 = 0.3f;
  if (this.shootingEntity != null) {

相关文章

Entity类方法