当前位置: 首页>>代码示例>>Java>>正文


Java World.getEntitiesWithinAABB方法代码示例

本文整理汇总了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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:EntityLeashKnot.java

示例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;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:18,代码来源:EntityLeashKnot.java

示例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;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:17,代码来源:GrowthSteps.java

示例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);
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:6,代码来源:WorldUtils.java

示例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;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:33,代码来源:BlockPressurePlate.java

示例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);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:8,代码来源:AutoPlantBrew.java

示例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);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:16,代码来源:SoulReminder.java

示例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();
		}
	}
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:13,代码来源:ItemCandy.java

示例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));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:BlockButton.java

示例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();
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:15,代码来源:EntityDispenser.java

示例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;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:BlockRedstoneComparator.java

示例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;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:BlockRedstoneComparator.java

示例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);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:5,代码来源:TileEntityHopper.java

示例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);
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:6,代码来源:WorldUtils.java

示例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]);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:6,代码来源:BlockRailDetector.java


注:本文中的net.minecraft.world.World.getEntitiesWithinAABB方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。