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


Java World.getEntitiesWithinAABBExcludingEntity方法代码示例

本文整理汇总了Java中net.minecraft.world.World.getEntitiesWithinAABBExcludingEntity方法的典型用法代码示例。如果您正苦于以下问题:Java World.getEntitiesWithinAABBExcludingEntity方法的具体用法?Java World.getEntitiesWithinAABBExcludingEntity怎么用?Java World.getEntitiesWithinAABBExcludingEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.World的用法示例。


在下文中一共展示了World.getEntitiesWithinAABBExcludingEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCastTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void onCastTick(World world, EntityPlayer player, ItemStack stack) {
	if (!world.isRemote) {
		BlockPos centerPos = player.getPosition();
		AxisAlignedBB area = new AxisAlignedBB(centerPos).expandXyz(3F);
		for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(player, area)) {
			if (entity instanceof EntityLivingBase) {
				WorldServer worldServer = (WorldServer) world;
				if (player.getItemInUseCount() % 10 == 0 && consumePower(player)) {
					MessageSoulDrainFX message = new MessageSoulDrainFX(entity.posX,
							entity.posY + (entity.height / 2.0F), entity.posZ, player.posX,
							player.posY + (player.height / 2.0F), player.posZ);
					PacketHandler.INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(
							player.dimension, player.posX, player.posY, player.posZ, 128));
					entity.attackEntityFrom(DamageSource.magic, 1);
					world.spawnEntity(new EntityXPOrb(world, entity.posX, entity.posY + 0.5, entity.posZ, 1));
				}
			}
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:22,代码来源:SpellSoulDrain.java

示例2: sendTurretStateMessageToPlayersInRange

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void sendTurretStateMessageToPlayersInRange(World world, Entity_AA turret, boolean hasArmor, boolean hasWeaponUpgrade, boolean hasRidingUpgrade, boolean hasPlatingUpgrade, boolean hasComUpgrade)
{
	// Step 1, who's in range?
	if (world.isRemote) { return; }	// Server-use only
	
	AxisAlignedBB box = turret.boundingBox.expand(64, 64, 64);	
	List list = world.getEntitiesWithinAABBExcludingEntity(turret, box);
	
	int counter = 0;
	
	while (counter < list.size())
	{
		Entity potentialPlayer = (Entity) list.get(counter);
		
		if (potentialPlayer instanceof EntityPlayer)
		{
			sendTurretStateMessageToPlayer((EntityPlayer) potentialPlayer, turret.getEntityId(), hasArmor, hasWeaponUpgrade, hasRidingUpgrade, hasPlatingUpgrade, hasComUpgrade);
		}
		// else, not a player. Don't care
		
		counter += 1;
	}
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:24,代码来源:NetHelper.java

示例3: pinchedByPlayer

import net.minecraft.world.World; //导入方法依赖的package包/类
private boolean pinchedByPlayer(World world)
{
    for (BlockPos bp : this.path)
    {
        //Block b = world.getBlockState(bp).getBlock();
        //AxisAlignedBB aabb = b.getCollisionBoundingBox(world, bp, b.getDefaultState());
        //aabb.expand(0, 1, 0);
        BlockPos bp2 = new BlockPos(bp.getX()+1, bp.getY()+2, bp.getZ()+1);
        AxisAlignedBB aabb = new AxisAlignedBB(bp, bp2);
        List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, aabb);
        for (Entity ent : entities)
            if (ent instanceof EntityPlayer)
                return true;
    }
    return false;
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:17,代码来源:MovingTargetDecoratorImplementation.java

示例4: computeRedstoneStrength

import net.minecraft.world.World; //导入方法依赖的package包/类
protected int computeRedstoneStrength(World worldIn, BlockPos pos)
{
    AxisAlignedBB axisalignedbb = PRESSURE_AABB.offset(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:sudofox,项目名称:Backmemed,代码行数:33,代码来源:BlockPressurePlate.java

示例5: updateState

import net.minecraft.world.World; //导入方法依赖的package包/类
private void updateState(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    boolean flag = ((Boolean)iblockstate.getValue(POWERED)).booleanValue();
    boolean flag1 = false;
    List <? extends Entity > list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, 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));

    if (!list.isEmpty())
    {
        for (Entity entity : list)
        {
            if (!entity.doesEntityNotTriggerPressurePlate())
            {
                flag1 = true;
                break;
            }
        }
    }

    if (flag1 != flag)
    {
        iblockstate = iblockstate.withProperty(POWERED, Boolean.valueOf(flag1));
        worldIn.setBlockState(pos, iblockstate, 3);
        this.notifyHook(worldIn, pos, iblockstate);
    }

    if (flag1)
    {
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:BlockTripWire.java

示例6: canAdvance

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public boolean canAdvance(World world, BlockPos pos, IBlockState state) {
	
	Entity item = null, chicken = null;
	List<Entity> entities = world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(pos.add(-3, 0, -3), pos.add(3, 1, 3)));
	for (Entity ent : entities) {
		if (!ent.isDead) {
			if (ent instanceof EntityChicken)
				chicken = ent;
			if (ent instanceof EntityItem && ((EntityItem)ent).getEntityItem().getItem() == Items.BOWL)
				item = ent;
			if (item != null && chicken != null)
				break;
		}
	}
	if (chicken != null && item != null) {
		AxisAlignedBB aabb = new AxisAlignedBB(chicken.getPosition().add(0, 0, 0), chicken.getPosition().add(1, 1, 1));
		List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(chicken, aabb);
		for (Entity entity : list) {
			if (entity != null && entity == item) {
				EntityItem ei = new EntityItem(item.worldObj, item.posX, item.posY, item.posZ, new ItemStack(UCItems.teriyaki));
				((EntityItem)item).getEntityItem().stackSize--;
				if (((EntityItem)item).getEntityItem().stackSize <= 0)
					item.setDead();
				chicken.setDead();
				UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.EXPLOSION_NORMAL, chicken.posX, chicken.posY + 0.5D, chicken.posZ, 3));
				if (!world.isRemote)
					world.spawnEntityInWorld(ei);
				return true;
			}
		}
	}
	else if (chicken != null) {
		UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.HEART, chicken.posX, chicken.posY + 1D, chicken.posZ, 3));
		return true;
	}
	return false;
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:39,代码来源:GrowthSteps.java

示例7: 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

示例8: func_190970_b

import net.minecraft.world.World; //导入方法依赖的package包/类
private void func_190970_b(World p_190970_1_, BlockPos p_190970_2_)
{
    IBlockState iblockstate = Blocks.DIRT.getDefaultState();
    p_190970_1_.setBlockState(p_190970_2_, iblockstate);
    AxisAlignedBB axisalignedbb = iblockstate.getCollisionBoundingBox(p_190970_1_, p_190970_2_).offset(p_190970_2_);

    for (Entity entity : p_190970_1_.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb))
    {
        entity.setPosition(entity.posX, axisalignedbb.maxY, entity.posZ);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:BlockFarmland.java

示例9: updateState

import net.minecraft.world.World; //导入方法依赖的package包/类
private void updateState(World worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    boolean flag = ((Boolean)iblockstate.getValue(POWERED)).booleanValue();
    boolean flag1 = false;
    List <? extends Entity > list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, iblockstate.getBoundingBox(worldIn, pos).offset(pos));

    if (!list.isEmpty())
    {
        for (Entity entity : list)
        {
            if (!entity.doesEntityNotTriggerPressurePlate())
            {
                flag1 = true;
                break;
            }
        }
    }

    if (flag1 != flag)
    {
        iblockstate = iblockstate.withProperty(POWERED, Boolean.valueOf(flag1));
        worldIn.setBlockState(pos, iblockstate, 3);
        this.notifyHook(worldIn, pos, iblockstate);
    }

    if (flag1)
    {
        worldIn.scheduleUpdate(new BlockPos(pos), this, this.tickRate(worldIn));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:32,代码来源:BlockTripWire.java

示例10: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    if (hand == EnumFacing.DOWN)
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        boolean flag = playerIn.getBlockState(worldIn).getBlock().isReplaceable(playerIn, worldIn);
        BlockPos blockpos = flag ? worldIn : worldIn.offset(hand);
        ItemStack itemstack = stack.getHeldItem(pos);

        if (!stack.canPlayerEdit(blockpos, hand, itemstack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag1 = !playerIn.isAirBlock(blockpos) && !playerIn.getBlockState(blockpos).getBlock().isReplaceable(playerIn, blockpos);
            flag1 = flag1 | (!playerIn.isAirBlock(blockpos1) && !playerIn.getBlockState(blockpos1).getBlock().isReplaceable(playerIn, blockpos1));

            if (flag1)
            {
                return EnumActionResult.FAIL;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = playerIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (!list.isEmpty())
                {
                    return EnumActionResult.FAIL;
                }
                else
                {
                    if (!playerIn.isRemote)
                    {
                        playerIn.setBlockToAir(blockpos);
                        playerIn.setBlockToAir(blockpos1);
                        EntityArmorStand entityarmorstand = new EntityArmorStand(playerIn, d0 + 0.5D, d1, d2 + 0.5D);
                        float f = (float)MathHelper.floor((MathHelper.wrapDegrees(stack.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
                        entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
                        this.applyRandomRotations(entityarmorstand, playerIn.rand);
                        ItemMonsterPlacer.applyItemEntityDataToEntity(playerIn, stack, itemstack, entityarmorstand);
                        playerIn.spawnEntityInWorld(entityarmorstand);
                        playerIn.playSound((EntityPlayer)null, entityarmorstand.posX, entityarmorstand.posY, entityarmorstand.posZ, SoundEvents.ENTITY_ARMORSTAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F);
                    }

                    itemstack.func_190918_g(1);
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:63,代码来源:ItemArmorStand.java

示例11: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    IBlockState iblockstate = playerIn.getBlockState(worldIn);

    if (iblockstate.getBlock() != Blocks.OBSIDIAN && iblockstate.getBlock() != Blocks.BEDROCK)
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        BlockPos blockpos = worldIn.up();
        ItemStack itemstack = stack.getHeldItem(pos);

        if (!stack.canPlayerEdit(blockpos, hand, itemstack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag = !playerIn.isAirBlock(blockpos) && !playerIn.getBlockState(blockpos).getBlock().isReplaceable(playerIn, blockpos);
            flag = flag | (!playerIn.isAirBlock(blockpos1) && !playerIn.getBlockState(blockpos1).getBlock().isReplaceable(playerIn, blockpos1));

            if (flag)
            {
                return EnumActionResult.FAIL;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = playerIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (!list.isEmpty())
                {
                    return EnumActionResult.FAIL;
                }
                else
                {
                    if (!playerIn.isRemote)
                    {
                        EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(playerIn, (double)((float)worldIn.getX() + 0.5F), (double)(worldIn.getY() + 1), (double)((float)worldIn.getZ() + 0.5F));
                        entityendercrystal.setShowBottom(false);
                        playerIn.spawnEntityInWorld(entityendercrystal);

                        if (playerIn.provider instanceof WorldProviderEnd)
                        {
                            DragonFightManager dragonfightmanager = ((WorldProviderEnd)playerIn.provider).getDragonFightManager();
                            dragonfightmanager.respawnDragon();
                        }
                    }

                    itemstack.func_190918_g(1);
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:64,代码来源:ItemEndCrystal.java

示例12: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (side == EnumFacing.DOWN)
    {
        return false;
    }
    else
    {
        boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
        BlockPos blockpos = flag ? pos : pos.offset(side);

        if (!playerIn.canPlayerEdit(blockpos, side, stack))
        {
            return false;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag1 = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
            flag1 = flag1 | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));

            if (flag1)
            {
                return false;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.fromBounds(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (list.size() > 0)
                {
                    return false;
                }
                else
                {
                    if (!worldIn.isRemote)
                    {
                        worldIn.setBlockToAir(blockpos);
                        worldIn.setBlockToAir(blockpos1);
                        EntityArmorStand entityarmorstand = new EntityArmorStand(worldIn, d0 + 0.5D, d1, d2 + 0.5D);
                        float f = (float)MathHelper.floor_float((MathHelper.wrapAngleTo180_float(playerIn.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
                        entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
                        this.applyRandomRotations(entityarmorstand, worldIn.rand);
                        NBTTagCompound nbttagcompound = stack.getTagCompound();

                        if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10))
                        {
                            NBTTagCompound nbttagcompound1 = new NBTTagCompound();
                            entityarmorstand.writeToNBTOptional(nbttagcompound1);
                            nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag"));
                            entityarmorstand.readFromNBT(nbttagcompound1);
                        }

                        worldIn.spawnEntityInWorld(entityarmorstand);
                    }

                    --stack.stackSize;
                    return true;
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:70,代码来源:ItemArmorStand.java

示例13: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    if (facing == EnumFacing.DOWN)
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
        BlockPos blockpos = flag ? pos : pos.offset(facing);

        if (!playerIn.canPlayerEdit(blockpos, facing, stack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag1 = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
            flag1 = flag1 | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));

            if (flag1)
            {
                return EnumActionResult.FAIL;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (!list.isEmpty())
                {
                    return EnumActionResult.FAIL;
                }
                else
                {
                    if (!worldIn.isRemote)
                    {
                        worldIn.setBlockToAir(blockpos);
                        worldIn.setBlockToAir(blockpos1);
                        EntityArmorStand entityarmorstand = new EntityArmorStand(worldIn, d0 + 0.5D, d1, d2 + 0.5D);
                        float f = (float)MathHelper.floor_float((MathHelper.wrapDegrees(playerIn.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
                        entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
                        this.applyRandomRotations(entityarmorstand, worldIn.rand);
                        ItemMonsterPlacer.applyItemEntityDataToEntity(worldIn, playerIn, stack, entityarmorstand);
                        worldIn.spawnEntityInWorld(entityarmorstand);
                        worldIn.playSound((EntityPlayer)null, entityarmorstand.posX, entityarmorstand.posY, entityarmorstand.posZ, SoundEvents.ENTITY_ARMORSTAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F);
                    }

                    --stack.stackSize;
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:62,代码来源:ItemArmorStand.java

示例14: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() != Blocks.OBSIDIAN && iblockstate.getBlock() != Blocks.BEDROCK)
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        BlockPos blockpos = pos.up();

        if (!playerIn.canPlayerEdit(blockpos, facing, stack))
        {
            return EnumActionResult.FAIL;
        }
        else
        {
            BlockPos blockpos1 = blockpos.up();
            boolean flag = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
            flag = flag | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));

            if (flag)
            {
                return EnumActionResult.FAIL;
            }
            else
            {
                double d0 = (double)blockpos.getX();
                double d1 = (double)blockpos.getY();
                double d2 = (double)blockpos.getZ();
                List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

                if (!list.isEmpty())
                {
                    return EnumActionResult.FAIL;
                }
                else
                {
                    if (!worldIn.isRemote)
                    {
                        EntityEnderCrystal entityendercrystal = new EntityEnderCrystal(worldIn, (double)((float)pos.getX() + 0.5F), (double)(pos.getY() + 1), (double)((float)pos.getZ() + 0.5F));
                        entityendercrystal.setShowBottom(false);
                        worldIn.spawnEntityInWorld(entityendercrystal);

                        if (worldIn.provider instanceof WorldProviderEnd)
                        {
                            DragonFightManager dragonfightmanager = ((WorldProviderEnd)worldIn.provider).getDragonFightManager();
                            dragonfightmanager.respawnDragon();
                        }
                    }

                    --stack.stackSize;
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:63,代码来源:ItemEndCrystal.java

示例15: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
	if (side == 0)
		return false;
	else {
		if (side == 1)
			y++;
		if (side == 2)
			z--;
		if (side == 3)
			z++;
		if (side == 4)
			x--;
		if (side == 5)
			x++;

		if (!player.canPlayerEdit(x, y, z, side, stack))
			return false;
		else {
			boolean flag1 = !world.isAirBlock(x, y, z) && !world.getBlock(x, y, z).isReplaceable(world, x, y, z);
			flag1 |= !world.isAirBlock(x, y + 1, z) && !world.getBlock(x, y + 1, z).isReplaceable(world, x, y + 1, z);

			if (flag1)
				return false;
			else {
				double d0 = x;
				double d1 = y;
				double d2 = z;
				List<Entity> list = world.getEntitiesWithinAABBExcludingEntity(null, AxisAlignedBB.getBoundingBox(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));

				if (list.size() > 0)
					return false;
				else {
					if (!world.isRemote) {
						world.setBlockToAir(x, y, z);
						world.setBlockToAir(x, y + 1, z);
						EntityArmourStand stand = new EntityArmourStand(world, d0 + 0.5D, d1, d2 + 0.5D);
						float f3 = MathHelper.floor_float((MathHelper.wrapAngleTo180_float(player.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
						stand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f3, 0.0F);
						applyRandomRotations(stand, world.rand);
						NBTTagCompound nbt = stack.getTagCompound();

						if (nbt != null && nbt.hasKey("EntityTag", 10)) {
							NBTTagCompound nbt1 = new NBTTagCompound();
							stand.writeToNBTOptional(nbt1);
							merge(nbt1, nbt.getCompoundTag("EntityTag"));
							stand.readFromNBT(nbt1);
						}

						world.spawnEntityInWorld(stand);
					}

					stack.stackSize--;
					return true;
				}
			}
		}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:61,代码来源:ItemArmourStand.java


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