Java Code Examples for net.minecraft.entity.player.EntityPlayer.getHeldItem()

The following are Jave code examples for showing how to use getHeldItem() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Torched   File: ItemTorchFirework.java   View Source Code Vote up 6 votes
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ)
{
    ItemStack is = player.getHeldItem(hand);
    if(is.getItemDamage() == 0)
    {
        if(side == EnumFacing.UP)
        {
            if(world.isSideSolid(pos, side, false))
            {
                is.shrink(1);
                if(!world.isRemote)
                {
                    world.spawnEntity(new EntityTorchFirework(world, pos.getX(), pos.getY(), pos.getZ(), player.capabilities.isCreativeMode && player.isSneaking()));
                }
                return EnumActionResult.SUCCESS;
            }
        }
    }
    return EnumActionResult.PASS;
}
 
Example 2
Project: Bewitchment   File: ItemHorseshoe.java   View Source Code Vote up 6 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
	if (!world.isRemote) {
		IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
		for (int i = 0; i < baubles.getSlots(); i++)
			if (baubles.getStackInSlot(i).isEmpty() && baubles.isItemValidForSlot(i, player.getHeldItem(hand), player)) {
				baubles.setStackInSlot(i, player.getHeldItem(hand).copy());
				if (!player.capabilities.isCreativeMode) {
					player.setHeldItem(hand, ItemStack.EMPTY);
				}
				onEquipped(player.getHeldItem(hand), player);
				break;
			}
	}
	return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
 
Example 3
Project: harshencastle   File: BaseBlockHarshenSingleInventory.java   View Source Code Vote up 6 votes
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
	ItemStack item = playerIn.getHeldItem(hand);
	TileEntity tileEntity = worldIn.getTileEntity(pos);
	if(tileEntity instanceof BaseTileEntityHarshenSingleItemInventory)
		if(((BaseTileEntityHarshenSingleItemInventory)tileEntity).canAddItem() && Item.getItemFromBlock(Blocks.AIR) != item.getItem())
		{
			int i =  item.getCount() - 1;
			if(((BaseTileEntityHarshenSingleItemInventory)tileEntity).setItem(item))
				playerIn.setHeldItem(hand, new ItemStack(item.getItem(), i, item.getMetadata(), item.serializeNBT()));
		}
		else if (!((BaseTileEntityHarshenSingleItemInventory) tileEntity).canAddItem())
		{
			ItemStack stack = ((BaseTileEntityHarshenSingleItemInventory)tileEntity).getItem();
			((BaseTileEntityHarshenSingleItemInventory)tileEntity).setItemAir();
			if(!worldIn.isRemote)
				InventoryHelper.spawnItemStack(worldIn, pos.getX(), pos.getY() + 0.7f, pos.getZ(), stack);
		}

	return true;
}
 
Example 4
Project: harshencastle   File: BaseHarshenBow.java   View Source Code Vote up 6 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
	ItemStack itemstack = playerIn.getHeldItem(handIn);
       boolean flag = !this.findAmmo(playerIn).isEmpty();

       ActionResult<ItemStack> ret = net.minecraftforge.event.ForgeEventFactory.onArrowNock(itemstack, worldIn, playerIn, handIn, flag);
       if (ret != null && arrowType != EnumHarshenArrowTypes.RIPPER) return ret;

       if (!playerIn.capabilities.isCreativeMode && !flag && arrowType != EnumHarshenArrowTypes.RIPPER)
       {
           return flag ? new ActionResult(EnumActionResult.PASS, itemstack) : new ActionResult(EnumActionResult.FAIL, itemstack);
       }
       else
       {
           playerIn.setActiveHand(handIn);
           return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
       }
}
 
Example 5
Project: interactionwheel   File: InventoryHelper.java   View Source Code Vote up 6 votes
/**
 * This function will first try to set the item at the 'heldItem' position if possible.
 * Otherwise it will try to find a suitable place elsewhere. If that fails it will spawn
 * the item in the world. The stack parameter may be modified
 */
public static void giveItemToPlayer(EntityPlayer player, ItemStack stack) {
    ItemStack heldItem = player.getHeldItem(EnumHand.MAIN_HAND);
    if (ItemStackTools.isEmpty(heldItem)) {
        player.setHeldItem(EnumHand.MAIN_HAND, stack);
        player.openContainer.detectAndSendChanges();
        return;
    } else if (isItemStackConsideredEqual(heldItem, stack)) {
        if (ItemStackTools.getStackSize(heldItem) < heldItem.getMaxStackSize()) {
            int itemsToAdd = Math.min(ItemStackTools.getStackSize(stack), heldItem.getMaxStackSize() - ItemStackTools.getStackSize(heldItem));
            ItemStackTools.incStackSize(heldItem, itemsToAdd);
            ItemStackTools.incStackSize(stack, -itemsToAdd);
            if (ItemStackTools.isEmpty(stack)) {
                player.openContainer.detectAndSendChanges();
                return;
            }
        }
    }
    // We have items remaining. Add them elsewhere
    if (player.inventory.addItemStackToInventory(stack)) {
        player.openContainer.detectAndSendChanges();
        return;
    }
    // Spawn in world
    spawnItemStack(player.getEntityWorld(), player.getPosition(), stack);
}
 
Example 6
Project: Backmemed   File: EntityLiving.java   View Source Code Vote up 6 votes
public final boolean processInitialInteract(EntityPlayer player, EnumHand stack)
{
    if (this.getLeashed() && this.getLeashedToEntity() == player)
    {
        this.clearLeashed(true, !player.capabilities.isCreativeMode);
        return true;
    }
    else
    {
        ItemStack itemstack = player.getHeldItem(stack);

        if (itemstack.getItem() == Items.LEAD && this.canBeLeashedTo(player))
        {
            this.setLeashedToEntity(player, true);
            itemstack.func_190918_g(1);
            return true;
        }
        else
        {
            return this.processInteract(player, stack) ? true : super.processInitialInteract(player, stack);
        }
    }
}
 
Example 7
Project: PurificatiMagicae   File: ItemPapyrus.java   View Source Code Vote up 6 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer p, EnumHand handIn)
{
    ItemStack stack = p.getHeldItem(handIn);
    if (!worldIn.isRemote)
    {
        IIfEntryStore store = p.getCapability(CapabilityRegistry.ENTRY_STORE_CAP, null);
        for (Pair<IfEntry, IRSReadPapyrus> pair : PurMag.INSTANCE.getIfRegistry().getAllResearchableSteps(IRSReadPapyrus.class, p, store))
        {
            if (pair.getRight().isSuitable(stack))
            {
                store.unlockStepAndSync(pair.getLeft().getId(), (EntityPlayerMP)p);
            }
        }
    }
    if (stack.hasTagCompound())
    {
        if (stack.getTagCompound().hasKey("papyrus_id"))
        {
            PurMag.proxy.openPapyrus(stack.getTagCompound().getString("papyrus_id"));
        }
    }
    return new ActionResult<>(EnumActionResult.PASS, stack);
}
 
Example 8
Project: MeeCreeps   File: PortalGunItem.java   View Source Code Vote up 6 votes
private void throwProjectile(EntityPlayer player, EnumHand hand, World world) {
    ItemStack heldItem = player.getHeldItem(hand);

    int charge = getCharge(heldItem);
    if (charge <= 0) {
        MeeCreepsMessages.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.gun_no_charge"), (EntityPlayerMP) player);
        return;
    }
    setCharge(heldItem, charge-1);

    List<TeleportDestination> destinations = getDestinations(heldItem);
    int current = getCurrentDestination(heldItem);
    if (current == -1) {
        MeeCreepsMessages.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.gun_no_destination"), (EntityPlayerMP) player);
    } else if (destinations.get(current) == null) {
        MeeCreepsMessages.INSTANCE.sendTo(new PacketShowBalloonToClient("message.meecreeps.gun_bad_destination"), (EntityPlayerMP) player);
    } else {
        EntityProjectile projectile = new EntityProjectile(world, player);
        projectile.setDestination(destinations.get(current));
        projectile.setPlayerId(player.getUniqueID());
        projectile.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
        world.spawnEntity(projectile);
    }
}
 
Example 9
Project: Backmemed   File: ItemSplashPotion.java   View Source Code Vote up 6 votes
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    ItemStack itemstack1 = worldIn.capabilities.isCreativeMode ? itemstack.copy() : itemstack.splitStack(1);
    itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!itemStackIn.isRemote)
    {
        EntityPotion entitypotion = new EntityPotion(itemStackIn, worldIn, itemstack1);
        entitypotion.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, -20.0F, 0.5F, 1.0F);
        itemStackIn.spawnEntityInWorld(entitypotion);
    }

    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
Example 10
Project: customstuff4   File: ItemSlab.java   View Source Code Vote up 5 votes
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (!itemstack.isEmpty() && player.canPlayerEdit(pos.offset(facing), facing, itemstack))
    {
        int subtype = getMetadata(itemstack);
        IBlockState currentState = worldIn.getBlockState(pos);

        if (currentState.getBlock() == singleSlab)
        {
            int subtype1 = this.singleSlabCS.getSubtype(currentState);
            net.minecraft.block.BlockSlab.EnumBlockHalf half = currentState.getValue(net.minecraft.block.BlockSlab.HALF);

            if ((facing == EnumFacing.UP && half == net.minecraft.block.BlockSlab.EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && half == net.minecraft.block.BlockSlab.EnumBlockHalf.TOP)
                && subtype1 == subtype)
            {
                IBlockState stateDouble = this.makeState(subtype1);
                AxisAlignedBB axisalignedbb = stateDouble == null ? Block.NULL_AABB : stateDouble.getCollisionBoundingBox(worldIn, pos);

                if (stateDouble != null && axisalignedbb != Block.NULL_AABB && worldIn.checkNoEntityCollision(axisalignedbb.offset(pos)) && worldIn.setBlockState(pos, stateDouble, 11))
                {
                    SoundType soundtype = stateDouble.getBlock().getSoundType(stateDouble, worldIn, pos, player);
                    worldIn.playSound(player, pos, soundtype.getPlaceSound(), SoundCategory.BLOCKS, (soundtype.getVolume() + 1.0F) / 2.0F, soundtype.getPitch() * 0.8F);
                    itemstack.shrink(1);
                }

                return EnumActionResult.SUCCESS;
            }
        }

        return this.tryPlace(player, itemstack, worldIn, pos.offset(facing), subtype) ? EnumActionResult.SUCCESS : super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ);
    } else
    {
        return EnumActionResult.FAIL;
    }
}
 
Example 11
Project: Mods   File: ItemRIG.java   View Source Code Vote up 5 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer living, EnumHand hand) {
	if(!world.isRemote) {
		living.setHeldItem(hand, RIG.equip(living, living.getHeldItem(hand)));
	}
	return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, living.getHeldItem(hand));
}
 
Example 12
Project: Backmemed   File: PlayerControllerMP.java   View Source Code Vote up 5 votes
public EnumActionResult processRightClick(EntityPlayer player, World worldIn, EnumHand stack)
{
    if (this.currentGameType == GameType.SPECTATOR)
    {
        return EnumActionResult.PASS;
    }
    else
    {
        this.syncCurrentPlayItem();
        this.connection.sendPacket(new CPacketPlayerTryUseItem(stack));
        ItemStack itemstack = player.getHeldItem(stack);

        if (player.getCooldownTracker().hasCooldown(itemstack.getItem()))
        {
            return EnumActionResult.PASS;
        }
        else
        {
            int i = itemstack.func_190916_E();
            ActionResult<ItemStack> actionresult = itemstack.useItemRightClick(worldIn, player, stack);
            ItemStack itemstack1 = (ItemStack)actionresult.getResult();

            if (itemstack1 != itemstack || itemstack1.func_190916_E() != i)
            {
                player.setHeldItem(stack, itemstack1);
            }

            return actionresult.getType();
        }
    }
}
 
Example 13
Project: Backmemed   File: ItemHangingEntity.java   View Source Code Vote up 5 votes
/**
 * 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)
{
    ItemStack itemstack = stack.getHeldItem(pos);
    BlockPos blockpos = worldIn.offset(hand);

    if (hand != EnumFacing.DOWN && hand != EnumFacing.UP && stack.canPlayerEdit(blockpos, hand, itemstack))
    {
        EntityHanging entityhanging = this.createEntity(playerIn, blockpos, hand);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!playerIn.isRemote)
            {
                entityhanging.playPlaceSound();
                playerIn.spawnEntityInWorld(entityhanging);
            }

            itemstack.func_190918_g(1);
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
Example 14
Project: harshencastle   File: GlassContainer.java   View Source Code Vote up 5 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
  {
if(!hasDrinkEffect(playerIn, handIn))
	return new ActionResult<ItemStack>(EnumActionResult.FAIL, playerIn.getHeldItem(handIn));
playerIn.setActiveHand(handIn);
      return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, playerIn.getHeldItem(handIn));
  }
 
Example 15
Project: PurificatiMagicae   File: PMMultiblock.java   View Source Code Vote up 5 votes
@Override
public Optional<Rotation> checkMultiblock(World w, BlockPos pos, @Nullable EntityPlayer p, @Nullable EnumHand hand)
{
    if(p != null && hand != null)
    {
        ItemStack st = p.getHeldItem(hand);
        if(!(st.getItem() instanceof ItemTinkeringKit && ((ItemTinkeringKit) st.getItem()).getTier() >= getTier()))
        {
            return Optional.empty();
        }
    }
    return super.checkMultiblock(w, pos, p, hand);
}
 
Example 16
Project: SimpleTubes   File: BlockDisplacer.java   View Source Code Vote up 5 votes
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

	if (!world.isRemote) {

		ItemStack held = player.getHeldItem(hand);

		if (player.isSneaking()) {

			if (state.getValue(FILTER) && ((TileDisplacer) world.getTileEntity(pos)).hasFilter()) {
				state = state.withProperty(FILTER, false);
				world.setBlockState(pos, state);

				if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileDisplacer) {
					((TileDisplacer) world.getTileEntity(pos)).setHasFilter(false);
					((TileDisplacer) world.getTileEntity(pos)).markDirty();

					PacketHandler.sendToAll(new PacketDisplacerSync(((TileDisplacer) world.getTileEntity(pos)), false));
					if (!player.isCreative())
						InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(SimpleTubes.proxy.itemUpgrade, 1, 0));
				}
			}
			return true;
		} else {
			if (!(held.getItem() instanceof ItemUpgrade) || held == ItemStack.EMPTY) {
				if (((TileDisplacer) world.getTileEntity(pos)).hasFilter()) {
					player.openGui(SimpleTubes.instance, 0, world, pos.getX(), pos.getY(), pos.getZ());
					return true;
				}
			}
		}
	}

	return true;
}
 
Example 17
Project: Bewitchment   File: ItemTarots.java   View Source Code Vote up 5 votes
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
	if (playerIn.isSneaking()) {
		ItemStack stack = playerIn.getHeldItem(handIn);
		if (!stack.hasTagCompound())
			stack.setTagCompound(new NBTTagCompound());
		stack.getTagCompound().setString("read_id", EntityPlayer.getUUID(playerIn.getGameProfile()).toString());
		stack.getTagCompound().setString("read_name", playerIn.getDisplayNameString());
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
	}
	return super.onItemRightClick(worldIn, playerIn, handIn);
}
 
Example 18
Project: Backmemed   File: ItemWrittenBook.java   View Source Code Vote up 5 votes
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (!itemStackIn.isRemote)
    {
        this.resolveContents(itemstack, worldIn);
    }

    worldIn.openBook(itemstack, playerIn);
    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
Example 19
Project: Mods   File: ItemMonsterPlacerPlus.java   View Source Code Vote up 4 votes
/**
 * Applies the data in the EntityTag tag of the given ItemStack to the given
 * Entity.
 */

@Override
public ActionResult<ItemStack> onItemRightClick( World worldIn, EntityPlayer playerIn,
		EnumHand hand) {
	ItemStack itemStackIn=playerIn.getHeldItem(hand);
	if (worldIn.isRemote)
		return new ActionResult<ItemStack>(EnumActionResult.PASS, itemStackIn);
	else {
		RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, true);

		if (raytraceresult != null && raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK) {
			BlockPos blockpos = raytraceresult.getBlockPos();

			if (!(worldIn.getBlockState(blockpos).getBlock() instanceof BlockLiquid))
				return new ActionResult<ItemStack>(EnumActionResult.PASS, itemStackIn);
			else if (worldIn.isBlockModifiable(playerIn, blockpos)
					&& playerIn.canPlayerEdit(blockpos, raytraceresult.sideHit, itemStackIn)) {
				
				boolean hastag = itemStackIn.getTagCompound() != null && itemStackIn.getTagCompound().hasKey("SavedEntity");
				
				EntityLivingBase entity = spawnCreature(worldIn, itemStackIn.getItemDamage(),
						blockpos.getX() + 0.5D, blockpos.getY() + 0.5D, blockpos.getZ() + 0.5D,
						hastag
								? itemStackIn.getTagCompound().getCompoundTag("SavedEntity") : null);

				if (entity == null)
					return new ActionResult(EnumActionResult.PASS, itemStackIn);
				else {
					if (entity instanceof EntityLivingBase && itemStackIn.hasDisplayName())
						entity.setCustomNameTag(itemStackIn.getDisplayName());

					if (!playerIn.capabilities.isCreativeMode)
						itemStackIn.shrink(1);
					if (entity instanceof EntityBuilding) {
						((EntityBuilding) entity).setOwner(playerIn);
						if(hastag) {
							((EntityBuilding) entity).setConstructing(true);
							((EntityBuilding) entity).redeploy = true;
						}
						entity.rotationYaw = playerIn.rotationYawHead;
						entity.renderYawOffset = playerIn.rotationYawHead;
						entity.rotationYawHead = playerIn.rotationYawHead;
						
						/*
						 * if(entity instanceof EntityTeleporter){
						 * ((EntityTeleporter)
						 * entity).setExit(itemStackIn.getItemDamage()>23);
						 * }
						 */
					}
					playerIn.addStat(StatList.getObjectUseStats(this));
					return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
				}
			} else
				return new ActionResult(EnumActionResult.FAIL, itemStackIn);
		} else
			return new ActionResult(EnumActionResult.PASS, itemStackIn);
	}
}
 
Example 20
Project: Backmemed   File: ItemArmorStand.java   View Source Code Vote up 4 votes
/**
 * 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;
                }
            }
        }
    }
}