本文整理汇总了Java中net.minecraft.world.World.getEntitiesWithinAABB方法的典型用法代码示例。如果您正苦于以下问题:Java World.getEntitiesWithinAABB方法的具体用法?Java World.getEntitiesWithinAABB怎么用?Java World.getEntitiesWithinAABB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.World
的用法示例。
在下文中一共展示了World.getEntitiesWithinAABB方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getKnotForPosition
import net.minecraft.world.World; //导入方法依赖的package包/类
public static EntityLeashKnot getKnotForPosition(World worldIn, BlockPos pos)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
for (EntityLeashKnot entityleashknot : worldIn.getEntitiesWithinAABB(EntityLeashKnot.class, new AxisAlignedBB((double)i - 1.0D, (double)j - 1.0D, (double)k - 1.0D, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D)))
{
if (entityleashknot.getHangingPosition().equals(pos))
{
return entityleashknot;
}
}
return null;
}
示例2: getKnotForPosition
import net.minecraft.world.World; //导入方法依赖的package包/类
@Nullable
public static EntityLeashKnot getKnotForPosition(World worldIn, BlockPos pos)
{
int i = pos.getX();
int j = pos.getY();
int k = pos.getZ();
for (EntityLeashKnot entityleashknot : worldIn.getEntitiesWithinAABB(EntityLeashKnot.class, new AxisAlignedBB((double)i - 1.0D, (double)j - 1.0D, (double)k - 1.0D, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D)))
{
if (entityleashknot.getHangingPosition().equals(pos))
{
return entityleashknot;
}
}
return null;
}
示例3: canAdvance
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
for (EntityItem item : items) {
if (!item.isDead && item.getEntityItem() != null) {
if (item.getEntityItem().getItem() == Items.WATER_BUCKET)
{
UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.WATER_DROP, pos.getX(), pos.getY(), pos.getZ(), 6));
item.setEntityItemStack(new ItemStack(Items.BUCKET, 1, 0));
return true;
}
}
}
return false;
}
示例4: getClosestEntity
import net.minecraft.world.World; //导入方法依赖的package包/类
public static <T extends Entity> T getClosestEntity(final World world, final Class<? extends T> classEntity, final BlockPos pos, double distance, Predicate<? super T> filter)
{
List<T> entities = world.getEntitiesWithinAABB(classEntity, new AxisAlignedBB(pos).grow(distance, distance, distance), filter);
return getClosestEntity(entities, pos);
}
示例5: computeRedstoneStrength
import net.minecraft.world.World; //导入方法依赖的package包/类
protected int computeRedstoneStrength(World worldIn, BlockPos pos)
{
AxisAlignedBB axisalignedbb = this.getSensitiveAABB(pos);
List <? extends Entity > list;
switch (this.sensitivity)
{
case EVERYTHING:
list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);
break;
case MOBS:
list = worldIn.<Entity>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
break;
default:
return 0;
}
if (!list.isEmpty())
{
for (Entity entity : list)
{
if (!entity.doesEntityNotTriggerPressurePlate())
{
return 15;
}
}
}
return 0;
}
示例6: safeImpact
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
void safeImpact(BlockPos pos, @Nullable EnumFacing side, World world, int amplifier) {
AxisAlignedBB space = new AxisAlignedBB(pos).grow(2 + MathHelper.clamp(amplifier, 0, 5));
List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, space, input -> input != null && isSeed(input.getItem()));
if (items.isEmpty()) return;
plantAll(items, world, pos, amplifier);
}
示例7: updateTick
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
isTicking = true;
List<Entity> playersWithin = worldIn.getEntitiesWithinAABB(EntityPlayer.class, new AxisAlignedBB(pos, pos.add(1, 1, 1)));
if(!playersWithin.isEmpty())
for(Object player: playersWithin.toArray())
((EntityPlayer)player).addPotionEffect(new PotionEffect(Potion.getPotionById(9), 200));
this.world = worldIn;
this.pos = pos;
worldIn.scheduleBlockUpdate(pos, this, 10, 3);
if(world != null && pos != null)
if (world instanceof WorldServer)
((WorldServer)world).spawnParticle(EnumParticleTypes.CLOUD, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 7, 0.3, 0.2, 0.3, 0, new int[EnumParticleTypes.CLOUD.getArgumentCount()]);
super.updateTick(worldIn, pos, state, rand);
}
示例8: onFoodEaten
import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player)
{
List<EntityCurse> entities = world.getEntitiesWithinAABB(EntityCurse.class, player.getEntityBoundingBox().grow(4.0D, 4.0D, 4.0D));
for (EntityCurse entity : entities)
{
if (entity.victim == player)
{
entity.setDead();
}
}
}
示例9: checkForArrows
import net.minecraft.world.World; //导入方法依赖的package包/类
private void checkForArrows(World worldIn, BlockPos pos, IBlockState state)
{
this.updateBlockBounds(state);
List <? extends Entity > list = worldIn.<Entity>getEntitiesWithinAABB(EntityArrow.class, new AxisAlignedBB((double)pos.getX() + this.minX, (double)pos.getY() + this.minY, (double)pos.getZ() + this.minZ, (double)pos.getX() + this.maxX, (double)pos.getY() + this.maxY, (double)pos.getZ() + this.maxZ));
boolean flag = !list.isEmpty();
boolean flag1 = ((Boolean)state.getValue(POWERED)).booleanValue();
if (flag && !flag1)
{
worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)));
this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING));
worldIn.markBlockRangeForRenderUpdate(pos, pos);
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
}
if (!flag && flag1)
{
worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(false)));
this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING));
worldIn.markBlockRangeForRenderUpdate(pos, pos);
worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag)
{
worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
}
}
示例10: isNearDispenser
import net.minecraft.world.World; //导入方法依赖的package包/类
public static boolean isNearDispenser(World world, final EntityLivingBase living) {
List<EntityDispenser> targetList = world.getEntitiesWithinAABB(EntityDispenser.class,
living.getEntityBoundingBox().grow(2.5D, 2D, 2.5D), new Predicate<EntityDispenser>() {
@Override
public boolean apply(EntityDispenser input) {
return !input.isDisabled() && input.dispenserTarget != null
&& input.dispenserTarget.contains(living);
}
});
return !targetList.isEmpty();
}
示例11: findItemFrame
import net.minecraft.world.World; //导入方法依赖的package包/类
private EntityItemFrame findItemFrame(World worldIn, final EnumFacing facing, BlockPos pos)
{
List<EntityItemFrame> list = worldIn.<EntityItemFrame>getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)), new Predicate<Entity>()
{
public boolean apply(Entity p_apply_1_)
{
return p_apply_1_ != null && p_apply_1_.getHorizontalFacing() == facing;
}
});
return list.size() == 1 ? (EntityItemFrame)list.get(0) : null;
}
示例12: findItemFrame
import net.minecraft.world.World; //导入方法依赖的package包/类
@Nullable
private EntityItemFrame findItemFrame(World worldIn, final EnumFacing facing, BlockPos pos)
{
List<EntityItemFrame> list = worldIn.<EntityItemFrame>getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)(pos.getX() + 1), (double)(pos.getY() + 1), (double)(pos.getZ() + 1)), new Predicate<Entity>()
{
public boolean apply(@Nullable Entity p_apply_1_)
{
return p_apply_1_ != null && p_apply_1_.getHorizontalFacing() == facing;
}
});
return list.size() == 1 ? (EntityItemFrame)list.get(0) : null;
}
示例13: func_181556_a
import net.minecraft.world.World; //导入方法依赖的package包/类
public static List<EntityItem> func_181556_a(World p_181556_0_, double p_181556_1_, double p_181556_3_, double p_181556_5_)
{
return p_181556_0_.<EntityItem>getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(p_181556_1_ - 0.5D, p_181556_3_ - 0.5D, p_181556_5_ - 0.5D, p_181556_1_ + 0.5D, p_181556_3_ + 0.5D, p_181556_5_ + 0.5D), EntitySelectors.selectAnything);
}
示例14: getRandomEntity
import net.minecraft.world.World; //导入方法依赖的package包/类
public static <T extends Entity> T getRandomEntity(final World world, final Class<? extends T> classEntity, final BlockPos pos, double distance, Predicate<? super T> filter)
{
List<T> entities = world.getEntitiesWithinAABB(classEntity, new AxisAlignedBB(pos).grow(distance, distance, distance), filter);
return getRandomEntity(entities, pos);
}
示例15: findMinecarts
import net.minecraft.world.World; //导入方法依赖的package包/类
protected <T extends EntityMinecart> List<T> findMinecarts(World worldIn, BlockPos pos, Class<T> clazz, Predicate<Entity>... filter)
{
AxisAlignedBB axisalignedbb = this.getDectectionBox(pos);
return filter.length != 1 ? worldIn.getEntitiesWithinAABB(clazz, axisalignedbb) : worldIn.getEntitiesWithinAABB(clazz, axisalignedbb, filter[0]);
}