當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。