本文整理了Java中net.minecraft.world.World.getEntitiesInAABBexcluding()
方法的一些代码示例,展示了World.getEntitiesInAABBexcluding()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。World.getEntitiesInAABBexcluding()
方法的具体详情如下:
包路径:net.minecraft.world.World
类名称:World
方法名:getEntitiesInAABBexcluding
暂无
代码示例来源:origin: Vazkii/Botania
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase entity, @Nonnull EntityLivingBase attacker) {
if(!(entity instanceof EntityPlayer) && entity != null) {
double range = 8;
List<EntityLivingBase> alreadyTargetedEntities = new ArrayList<>();
int dmg = 5;
long lightningSeed = ItemNBTHelper.getLong(stack, TAG_LIGHTNING_SEED, 0);
Predicate<Entity> selector = e -> e instanceof EntityLivingBase && e instanceof IMob && !(e instanceof EntityPlayer) && !alreadyTargetedEntities.contains(e);
Random rand = new Random(lightningSeed);
EntityLivingBase lightningSource = entity;
int hops = entity.world.isThundering() ? 10 : 4;
for(int i = 0; i < hops; i++) {
List<Entity> entities = entity.world.getEntitiesInAABBexcluding(lightningSource, new AxisAlignedBB(lightningSource.posX - range, lightningSource.posY - range, lightningSource.posZ - range, lightningSource.posX + range, lightningSource.posY + range, lightningSource.posZ + range), selector::test);
if(entities.isEmpty())
break;
EntityLivingBase target = (EntityLivingBase) entities.get(rand.nextInt(entities.size()));
if(attacker instanceof EntityPlayer)
target.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) attacker), dmg);
else target.attackEntityFrom(DamageSource.causeMobDamage(attacker), dmg);
Botania.proxy.lightningFX(Vector3.fromEntityCenter(lightningSource), Vector3.fromEntityCenter(target), 1, 0x0179C4, 0xAADFFF);
alreadyTargetedEntities.add(target);
lightningSource = target;
dmg--;
}
if(!entity.world.isRemote)
ItemNBTHelper.setLong(stack, TAG_LIGHTNING_SEED, entity.world.rand.nextLong());
}
return super.hitEntity(stack, entity, attacker);
}
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public @Nonnull List<Entity> getEntitiesInAABBexcluding(@Nullable Entity entityIn, @Nonnull AxisAlignedBB boundingBox,
@Nullable Predicate<? super Entity> predicate) {
return wrapped.getEntitiesInAABBexcluding(entityIn, boundingBox, predicate);
}
代码示例来源:origin: amadornes/MCMultiPart
@Override
public List<Entity> getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate<? super Entity> predicate) {
return getActualWorld().getEntitiesInAABBexcluding(entityIn, boundingBox, predicate);
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
private boolean areMyrmexNear(double distance){
List<Entity> sentinels = this.myrmex.world.getEntitiesInAABBexcluding(this.myrmex, this.getTargetableArea(distance), this.targetEntitySelector);
List<Entity> hiddenSentinels = new ArrayList<>();
for(Entity sentinel : sentinels){
if(sentinel instanceof EntityMyrmexSentinel && ((EntityMyrmexSentinel) sentinel).isHiding()){
hiddenSentinels.add(sentinel);
}
}
return !hiddenSentinels.isEmpty();
}
代码示例来源:origin: CyclopsMC/EvilCraft
protected void collideWithNearbyEntities() {
List<Entity> list = this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D), Predicates.<Entity>and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>() {
public boolean apply(Entity p_apply_1_) {
return p_apply_1_.canBePushed();
}
}));
if (!list.isEmpty()){
for (Entity entity : list) {
this.applyEntityCollision(entity);
}
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Nullable
public static StymphalianBirdFlock getNearbyFlock(EntityStymphalianBird bird){
float d0 = IceAndFire.CONFIG.stymphalianBirdFlockLength;
List<Entity> list = bird.world.getEntitiesInAABBexcluding(bird, (new AxisAlignedBB(bird.posX, bird.posY, bird.posZ, bird.posX + 1.0D, bird.posY + 1.0D, bird.posZ + 1.0D)).grow(d0, 10.0D, d0), EntityStymphalianBird.STYMPHALIAN_PREDICATE);
Collections.sort(list, new EntityAINearestAttackableTarget.Sorter(bird));
if (!list.isEmpty()) {
Iterator<Entity> itr = list.iterator();
while (itr.hasNext()) {
Entity entity = itr.next();
if(entity instanceof EntityStymphalianBird){
EntityStymphalianBird other = (EntityStymphalianBird)entity;
if(other.flock != null){
return other.flock;
}
}
}
}
return null;
}
public void addToFlock(EntityStymphalianBird bird){
代码示例来源:origin: ldtteam/minecolonies
/**
* Returns the closest entity to avoid.
*
* @return Entity to avoid.
*/
private Entity getClosestToAvoid()
{
if (targetEntityClass == EntityPlayer.class)
{
return CompatibilityUtils.getWorld(theEntity).getClosestPlayerToEntity(theEntity, (double) distanceFromEntity);
}
else
{
final Optional<Entity> entityOptional = CompatibilityUtils.getWorld(theEntity).getEntitiesInAABBexcluding(
theEntity,
theEntity.getEntityBoundingBox().expand(
(double) distanceFromEntity,
3.0D,
(double) distanceFromEntity),
target -> target.isEntityAlive() && EntityAICitizenAvoidEntity.this.theEntity.getEntitySenses().canSee(target))
.stream()
.filter(targetEntityClass::isInstance)
.findFirst();
return entityOptional.isPresent() ? entityOptional.get() : null;
}
}
代码示例来源:origin: Vazkii/Quark
@Override
public boolean onValidSurface() {
if(this.realFacingDirection.getAxis() == EnumFacing.Axis.Y) {
if(!this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()) {
return false;
} else {
BlockPos blockpos = this.hangingPosition.offset(this.realFacingDirection.getOpposite());
IBlockState iblockstate = this.world.getBlockState(blockpos);
if(!iblockstate.isSideSolid(this.world, blockpos, this.realFacingDirection))
if(!iblockstate.getMaterial().isSolid() && !BlockRedstoneDiode.isDiode(iblockstate))
return false;
return this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), IS_HANGING_ENTITY).isEmpty();
}
} else
return super.onValidSurface();
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
@Override
public boolean shouldExecute() {
if (!this.myrmex.canMove() || this.myrmex.getAttackTarget() != null || this.myrmex.releaseTicks < 400 || this.myrmex.mate != null) {
return false;
}
MyrmexHive village = this.myrmex.getHive();
if (village == null) {
village = MyrmexWorldData.get(this.myrmex.world).getNearestHive(new BlockPos(this.myrmex), 100);
}
if (village != null) {
return false;
}
List<Entity> list = this.taskOwner.world.getEntitiesInAABBexcluding(myrmex, this.getTargetableArea(this.getTargetDistance()), this.targetEntitySelector);
if (list.isEmpty()) {
return false;
} else {
Collections.sort(list, this.theNearestAttackableTargetSorter);
for(Entity royal : list){
if(this.myrmex.canMateWith((EntityMyrmexRoyal)royal)){
this.myrmex.mate = (EntityMyrmexRoyal)royal;
this.myrmex.world.setEntityState(this.myrmex, (byte) 76);
return true;
}
}
return false;
}
}
代码示例来源:origin: Alex-the-666/Ice_and_Fire
double d1 = dist;
Entity pointedEntity = null;
List<Entity> list = rider.world.getEntitiesInAABBexcluding(rider, rider.getEntityBoundingBox().expand(vec3d1.x * dist, vec3d1.y * dist, vec3d1.z * dist).grow(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>() {
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: JurassiCraftTeam/JurassiCraft2
@Override
public boolean onValidSurface() {
if (!this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()) {
return false;
}
int width = this.getWidthPixels() / 16;
int height = this.getHeightPixels() / 16;
EnumFacing facing = this.facingDirection.rotateYCCW();
BlockPos pos = this.hangingPosition.offset(this.facingDirection.getOpposite()).offset(facing, -(width / 2) + 1);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
BlockPos partPos = pos.offset(facing, x).down(y);
IBlockState state = this.world.getBlockState(partPos);
if (!(state.isSideSolid(this.world, partPos, this.facingDirection) && state.getMaterial().isSolid())) {
return false;
}
}
}
return this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), IS_ATTRACTION_SIGN).isEmpty();
}
代码示例来源:origin: JurassiCraftTeam/JurassiCraft2
@Override
public boolean onValidSurface() {
if (!this.world.getCollisionBoxes(this, this.getEntityBoundingBox()).isEmpty()) {
return false;
}
int width = this.getWidthPixels() / 16;
int height = this.getHeightPixels() / 16;
EnumFacing facing = this.facingDirection.rotateYCCW();
BlockPos pos = this.hangingPosition.offset(this.facingDirection.getOpposite()).offset(facing, -(width / 2) + 1);
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
BlockPos partPos = pos.offset(facing, x).down(y);
IBlockState state = this.world.getBlockState(partPos);
if (!(state.isSideSolid(this.world, partPos, this.facingDirection) && state.getMaterial().isSolid())) {
return false;
}
}
}
return this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox(), IS_MURAL).isEmpty();
}
代码示例来源:origin: TeamLapen/Vampirism
@Override
public boolean activate(final IVampirePlayer vampire) {
EntityPlayer player = vampire.getRepresentingPlayer();
List l = player.getEntityWorld().getEntitiesInAABBexcluding(player, player.getEntityBoundingBox().grow(10, 5, 10), vampire.getNonFriendlySelector(true, false)::test);
for (Object o : l) {
if (o instanceof EntityBlindingBat) continue;
if (!(o instanceof EntityLivingBase)) continue;
if (o instanceof EntityPlayer && ItemHunterCoat.isFullyEquipped((EntityPlayer) o)) continue;
EntityLivingBase e = (EntityLivingBase) o;
e.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, Balance.vpa.FREEZE_DURATION * 20, 10));
e.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, Balance.vpa.FREEZE_DURATION * 20, 10));
e.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, Balance.vpa.FREEZE_DURATION * 20, 128));
VampLib.proxy.getParticleHandler().spawnParticles(player.getEntityWorld(), ModParticles.GENERIC_PARTICLE, e.posX, e.posY + e.height / 2, e.posZ, 20, 1, e.getRNG(), 2, 20, 0xF0F0F0, 0.4);
}
return l.size() > 0;
}
代码示例来源:origin: TeamWizardry/Wizardry
List<Entity> entities = world.getEntitiesInAABBexcluding(this, new AxisAlignedBB(getPosition()).grow(64, 64, 64), null);
for (Entity entity : entities)
if (entity instanceof EntityPlayer) {
List<Entity> entities = world.getEntitiesInAABBexcluding(this, new AxisAlignedBB(getPosition()).grow(5, 5, 5), null);
for (Entity entity : entities)
if (entity instanceof EntityLivingBase) {
代码示例来源:origin: TeamLapen/Vampirism
List<Entity> list = this.world.getEntitiesInAABBexcluding(this, this.getEntityBoundingBox().grow(2), Predicates.and(EntitySelectors.IS_ALIVE, EntitySelectors.NOT_SPECTATING));
for (Entity e : list) {
if (excludeShooter && e == shootingEntity) {
代码示例来源:origin: Alex-the-666/Ice_and_Fire
double d1 = dist;
Entity pointedEntity = null;
List<Entity> list = worldIn.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().expand(vec3d1.x * dist, vec3d1.y * dist, vec3d1.z * dist).grow(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new Predicate<Entity>() {
public boolean apply(@Nullable Entity entity) {
boolean blindness = entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isPotionActive(MobEffects.BLINDNESS) || (entity instanceof IBlacklistedFromStatues && !((IBlacklistedFromStatues) entity).canBeTurnedToStone());
代码示例来源:origin: sinkillerj/ProjectE
List<Entity> entities = player.getEntityWorld().getEntitiesInAABBexcluding(player,
player.getEntityBoundingBox().offset(player.motionX, player.motionY, player.motionZ).grow(2.0D),
Predicates.instanceOf(EntityLivingBase.class));
代码示例来源:origin: CyclopsMC/EvilCraft
List<Entity> entities = world.getEntitiesInAABBexcluding(entity, box, new Predicate<Entity>() {
代码示例来源:origin: SquidDev-CC/plethora
List<Entity> entityList = entity.getEntityWorld().getEntitiesInAABBexcluding(
entity,
entity.getEntityBoundingBox().expand(
内容来源于网络,如有侵权,请联系作者删除!