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

The following examples show how to use net.minecraft.entity.player.EntityPlayer#getEntityWorld() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public QuestData generateQuestFor(EntityPlayer player, Province province) {
	Random rand = player.getEntityWorld().rand;
	QuestData data = new QuestData();
	data.setCiv(province.civilization);
	data.setPlayer(player);
	data.setProvinceId(province.id);
	data.setQuestId(UUID.randomUUID());
	data.setQuestType(ID);
	data.setCompleted(false);
	chooseEnemyType(data);
	setRewardRep(data, 50);

	List<ItemStack> reward = new ArrayList<ItemStack>(1);
	reward.add(new ItemStack(Items.EMERALD, 10));
	setRewardItems(data, reward);

	return data;
}
 
Example 2
protected boolean handleEnderElevator(final MessageKeyPressed message, EntityPlayer player)
{
    if (message.keyPressed == HotKeys.KEYCODE_JUMP || message.keyPressed == HotKeys.KEYCODE_SNEAK)
    {
        BlockPos pos = new BlockPos(player.posX, player.posY, player.posZ);
        World world = player.getEntityWorld();
        TileEntityElevator te = BlockEnderUtilitiesTileEntity.getTileEntitySafely(world, pos, TileEntityElevator.class);

        if (te == null)
        {
            te = BlockEnderUtilitiesTileEntity.getTileEntitySafely(world, pos.down(), TileEntityElevator.class);
        }

        if (te != null)
        {
            te.activateForEntity(player, message.keyPressed == HotKeys.KEYCODE_JUMP);
            return true;
        }
    }

    return false;
}
 
Example 3
private boolean handleKeysGeneric(int key, EntityPlayer player)
{
    World world = player.getEntityWorld();
    RayTraceResult trace = EntityUtils.getRayTraceFromPlayer(world, player, true);

    if (trace != null && trace.typeOfHit == RayTraceResult.Type.BLOCK)
    {
        BlockPos pos = trace.getBlockPos();
        TileEntityEnderUtilities te = BlockEnderUtilities.getTileEntitySafely(world, pos, TileEntityEnderUtilities.class);

        if (te != null)
        {
            return te.onInputAction(key, player, trace, world, pos);
        }
    }

    return false;
}
 
Example 4
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase livingBase, EnumHand hand)
{
    // Jailer module
    if (this.getModuleType(stack).equals(ModuleType.TYPE_MOBPERSISTENCE))
    {
        if (livingBase instanceof EntityLiving && EntityUtils.applyMobPersistence((EntityLiving)livingBase))
        {
            if (player.getEntityWorld().isRemote == false && player.capabilities.isCreativeMode == false)
            {
                stack.shrink(1);
            }

            return true;
        }
    }

    return false;
}
 
Example 5
@Override
public boolean onBlockStartBreak(ItemStack stack, BlockPos pos, EntityPlayer player)
{
    //System.out.printf("onBlockStartBreak() @ %s\n", player.getEntityWorld().isRemote ? "client" : "server");
    World world = player.getEntityWorld();
    IBlockState state = world.getBlockState(pos);

    if (state.getBlockHardness(world, pos) >= 0f)
    {
        if (world.isRemote == false)
        {
            BlockUtils.setBlockToAirWithoutSpillingContents(world, pos);
        }

        if (player.capabilities.isCreativeMode == false)
        {
            this.addToolDamage(stack, world, pos, state, player);
        }

        return world.isRemote == false;
    }

    return false;
}
 
Example 6
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
    if (player.getEntityWorld().isRemote == false && entity instanceof EntityChair)
    {
        entity.setDead();
        return true;
    }

    return super.onLeftClickEntity(stack, player, entity);
}
 
Example 7
@Override
public QuestData generateQuestFor(EntityPlayer player, Province province) {
	Random rand = player.getEntityWorld().rand;

	switch (rand.nextInt(3)) {
	case 0:
		return quest1(province, player);
	case 1:
		return quest2(province, player);
	case 2:
		return questDarkOak(province, player);
	default:
		return quest1(province, player);
	}
}
 
Example 8
public InventoryItemModular(ItemStack containerStack, EntityPlayer player, int mainInvSize, boolean allowCustomStackSizes, int moduleInvSize, ModuleType moduleType)
{
    super(containerStack, mainInvSize, 64, allowCustomStackSizes, player.getEntityWorld().isRemote, player);

    this.modularItemStack = containerStack;
    this.moduleType = moduleType;
    this.containerUUID = NBTUtils.getUUIDFromItemStack(containerStack, "UUID", true);
    this.hostInventory = null;

    this.moduleInventory = new InventoryItemMemoryCards(this, containerStack, moduleInvSize, player.getEntityWorld().isRemote);
    this.moduleInventory.readFromContainerItemStack();

    this.readFromContainerItemStack();
}
 
Example 9
@SubscribeEvent
public void spawnSentries(PlayerTickEvent event) {
	if (TickEvent.Phase.START.equals(event.phase)) {
		return;
	}
	EntityPlayer player = event.player;
	World world = player.getEntityWorld();

	if (world.isRemote || world.getTotalWorldTime() % 200 != 0) {
		return;
	}

	spawnSentry(player, player.getPosition(), world);
	spawnFugitive(player.getPosition(), world);
}
 
Example 10
private ItemStack getItemForUse(ItemStack stackNullifier, EntityPlayer player)
{
    // Create the inventory here by pretending to be on the server side,
    // so that the readFromContainerItemStack() call actually reads the items on the client side too.
    // This is (mostly only?) required to get the block placing sounds to work on the client.
    // Ie. in other words, to get the correct item to use also on the client side.
    ItemHandlerNullifier inv = createInventoryForItem(stackNullifier, false);

    int slot = MathHelper.clamp(NBTUtils.getByte(stackNullifier, TAG_NAME_CONTAINER, TAG_NAME_SLOT_SELECTION), 0, inv.getSlots() - 1);
    boolean simulate = player.getEntityWorld().isRemote || player.capabilities.isCreativeMode;
    return inv.extractItem(slot, 1, simulate);
}
 
Example 11
public static void create(ItemStack stack, EntityPlayer player)
{
	NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);
	
	if (nbt != null)
	{
		Rarity rarity = Rarity.getRarity(nbt);
		Random rand = player.getEntityWorld().rand;
		
		if (rarity == Rarity.DEFAULT)
		{				
			Rarity.setRarity(nbt, Rarity.getRandomRarity(nbt, rand)); // sets random rarity

			if (Rarity.getRarity(nbt) == Rarity.MYTHIC)
			{
				SPacketTitle packet = new SPacketTitle(SPacketTitle.Type.TITLE, new TextComponentString(TextFormatting.GOLD + "MYTHIC"), -1, 20, -1);
				EntityPlayerMP playermp = (EntityPlayerMP) player;
				playermp.connection.sendPacket(packet);
				Levels.network.sendTo(new PacketMythicSound(), (EntityPlayerMP) player);
			}
			
			if (Config.unlimitedDurability)
			{
				nbt.setInteger("Unbreakable", 1); // adds Unbreakable tag to item
			}
			
			Experience.setLevel(nbt, 1);
			nbt.setDouble("Multiplier", getWeightedMultiplier(Rarity.getRarity(nbt))); // adds a randomized multiplier to the item, weighted by rarity
			nbt.setInteger("HideFlags", 6); // hides Attribute Modifier and Unbreakable tags
			setAttributeModifiers(nbt, stack); // sets up Attribute Modifiers
			NBTHelper.saveStackNBT(stack, nbt);
		}
	}
}
 
Example 12
@Override
public boolean processInitialInteract(EntityPlayer player, EnumHand hand)
{
    if (player.getEntityWorld().isRemote == false && this.getPassengers().contains(player) == false)
    {
        player.startRiding(this);
        return true;
    }

    return false;
}
 
Example 13
protected void processMessage(final MessageSyncTileEntity message, EntityPlayer player)
{
    World world = player.getEntityWorld();
    TileEntity te = world.getTileEntity(message.pos);

    if (te instanceof ISyncableTile)
    {
        ISyncableTile syncable = (ISyncableTile) te;
        syncable.syncTile(message.intValues, message.stacks);
    }
}
 
Example 14
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
    if (player == null || player.getEntityWorld().isRemote || player.isSneaking() == false ||
        OwnerData.canAccessSelectedModule(stack, ModuleType.TYPE_LINKCRYSTAL, player) == false)
    {
        return false;
    }

    return this.doTeleport(stack, entity, true);
}
 
Example 15
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
	EntityPlayer p = Minecraft.getMinecraft().player;
	if (p != null) {
		if (p.getEntityWorld().provider instanceof WorldProviderUnderWorld) {
			ResourceLocation sides = new ResourceLocation(Wizardry.MODID, "textures/misc/underworld_sky.png");
			ResourceLocation top = new ResourceLocation(Wizardry.MODID, "textures/misc/underworld_sky_top.png");
			ResourceLocation bottom = new ResourceLocation(Wizardry.MODID, "textures/misc/underworld_sky_bottom.png");
			Minecraft.getMinecraft().renderEngine.bindTexture(sides);
			GlStateManager.pushMatrix();
			GlStateManager.disableCull();
			GlStateManager.disableFog();
			GlStateManager.disableLighting();

			GlStateManager.depthMask(false);
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vertexbuffer = tessellator.getBuffer();

			for (int i = 0; i < 6; ++i) {
				GlStateManager.pushMatrix();

				Minecraft.getMinecraft().renderEngine.bindTexture(bottom);
				if (i == 3) {
					Minecraft.getMinecraft().renderEngine.bindTexture(top);
					GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 1) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 2) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
					GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 4) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 5) {
					Minecraft.getMinecraft().renderEngine.bindTexture(sides);
					GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(-270.0F, 0.0F, 1.0F, 0.0F);
				}

				vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
				vertexbuffer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).endVertex();
				vertexbuffer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, 100.0D).tex(1.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, -100.0D).tex(1.0D, 0.0D).endVertex();
				tessellator.draw();
				GlStateManager.popMatrix();
			}

			GlStateManager.depthMask(true);
			GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
			GlStateManager.enableCull();
			GlStateManager.enableLighting();
			GlStateManager.disableAlpha();
			GlStateManager.enableFog();
			GlStateManager.disableBlend();
			GlStateManager.popMatrix();
		}
	}
}
 
Example 16
@Override
public void render(float partialTicks, WorldClient world, Minecraft mc) {
	EntityPlayer p = Minecraft.getMinecraft().player;
	if (p != null) {
		if (p.getEntityWorld().provider instanceof WorldProviderTorikki) {
			ResourceLocation img = new ResourceLocation(Wizardry.MODID, "textures/misc/torikki_sky.png");
			Minecraft.getMinecraft().renderEngine.bindTexture(img);
			GlStateManager.pushMatrix();
			GlStateManager.disableCull();
			GlStateManager.disableFog();
			GlStateManager.disableLighting();

			GlStateManager.depthMask(false);
			Tessellator tessellator = Tessellator.getInstance();
			BufferBuilder vertexbuffer = tessellator.getBuffer();

			for (int i = 0; i < 6; ++i) {
				GlStateManager.pushMatrix();

				Minecraft.getMinecraft().renderEngine.bindTexture(img);
				if (i == 3) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 1) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
				}
				if (i == 2) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
					GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 4) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(270.0F, 0.0F, 1.0F, 0.0F);
				}
				if (i == 5) {
					Minecraft.getMinecraft().renderEngine.bindTexture(img);
					GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
					GlStateManager.rotate(-270.0F, 0.0F, 1.0F, 0.0F);
				}

				vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
				vertexbuffer.pos(-100.0D, -100.0D, -100.0D).tex(0.0D, 0.0D).endVertex();
				vertexbuffer.pos(-100.0D, -100.0D, 100.0D).tex(0.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, 100.0D).tex(1.0D, 1.0D).endVertex();
				vertexbuffer.pos(100.0D, -100.0D, -100.0D).tex(1.0D, 0.0D).endVertex();
				tessellator.draw();
				GlStateManager.popMatrix();
			}

			GlStateManager.depthMask(true);
			GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
			GlStateManager.enableCull();
			GlStateManager.enableLighting();
			GlStateManager.disableAlpha();
			GlStateManager.enableFog();
			GlStateManager.disableBlend();
			GlStateManager.popMatrix();
		}
	}
}
 
Example 17
/**
 * Tries to first fill the matching stacks in the player's inventory,
 * and then depending on the bag's mode, tries to add the remaining items
 * to the bag's inventory.
 * @param event
 * @return true if all items were handled and further processing of the event should not occur
 */
public static boolean onEntityItemPickupEvent(EntityItemPickupEvent event)
{
    EntityItem entityItem = event.getItem();
    ItemStack stack = entityItem.getItem();
    EntityPlayer player = event.getEntityPlayer();

    if (player.getEntityWorld().isRemote || entityItem.isDead || stack.isEmpty())
    {
        return true;
    }

    ItemStack origStack = ItemStack.EMPTY;
    final int origStackSize = stack.getCount();
    int stackSizeLast = origStackSize;
    boolean ret = false;

    IItemHandler playerInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
    // Not all the items could fit into existing stacks in the player's inventory, move them directly to the nullifier
    List<Integer> slots = InventoryUtils.getSlotNumbersOfMatchingItems(playerInv, EnderUtilitiesItems.NULLIFIER);

    for (int slot : slots)
    {
        ItemStack nullifierStack = playerInv.getStackInSlot(slot);

        // Nullifier is not disabled
        if (nullifierStack.isEmpty() == false && isNullifierEnabled(nullifierStack))
        {
            // Delayed the stack copying until we know if there is a valid bag,
            // so check if the stack was copied already or not.
            if (origStack == ItemStack.EMPTY)
            {
                origStack = stack.copy();
            }

            stack = handleItems(stack, nullifierStack, player);

            if (stack.isEmpty() || stack.getCount() != stackSizeLast)
            {
                if (stack.isEmpty())
                {
                    entityItem.setDead();
                    event.setCanceled(true);
                    ret = true;
                    break;
                }

                ItemStack pickedUpStack = origStack.copy();
                pickedUpStack.setCount(stackSizeLast - stack.getCount());

                FMLCommonHandler.instance().firePlayerItemPickupEvent(player, entityItem, pickedUpStack);
                player.onItemPickup(entityItem, origStackSize);
            }

            stackSizeLast = stack.getCount();
        }
    }

    // Not everything was handled, update the stack
    if (entityItem.isDead == false && stack.getCount() != origStackSize)
    {
        entityItem.setItem(stack);
    }

    // At least some items were picked up
    if (entityItem.isSilent() == false && (entityItem.isDead || stack.getCount() != origStackSize))
    {
        player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.MASTER,
                0.2F, ((itemRand.nextFloat() - itemRand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
    }

    return ret;
}
 
Example 18
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand)
{
    int meta = stack.getMetadata();

    if (meta == 0 || (target instanceof EntityLiving) == false)
    {
        return super.itemInteractionForEntity(stack, playerIn, target, hand);
    }

    EntityLiving living = (EntityLiving) target;

    // 1: Paralyzer - set NoAI
    // 2: Stimulant - disable NoAI
    if (meta == 1 || meta == 2)
    {
        boolean noAI = meta == 1;

        if (living.isAIDisabled() != noAI)
        {
            if (playerIn.getEntityWorld().isRemote == false)
            {
                living.setNoAI(noAI);

                if (playerIn.capabilities.isCreativeMode == false)
                {
                    stack.setItemDamage(0);
                }

                playerIn.getEntityWorld().playSound(null, playerIn.getPosition(), SoundEvents.ITEM_BUCKET_EMPTY_LAVA, SoundCategory.MASTER, 0.9f, 3.0f);
            }

            return true;
        }
    }

    // 3: Passifier - remove target AI tasks and set a flag which causes the removal to happen on (re-)spawn
    if (meta == 3)
    {
        if (playerIn.getEntityWorld().isRemote == false && passifyEntity(living))
        {
            if (playerIn.capabilities.isCreativeMode == false)
            {
                stack.setItemDamage(0);
            }

            playerIn.getEntityWorld().playSound(null, playerIn.getPosition(), SoundEvents.ITEM_BUCKET_EMPTY_LAVA, SoundCategory.MASTER, 0.9f, 3.0f);
        }

        return true;
    }

    return super.itemInteractionForEntity(stack, playerIn, target, hand);
}
 
Example 19
/**
 * Tries to first fill the matching stacks in the player's inventory,
 * and then depending on the bag's mode, tries to add the remaining items
 * to the bag's inventory.
 * @param event
 * @return true if all items were handled and further processing of the event should not occur
 */
public static boolean onEntityItemPickupEvent(EntityItemPickupEvent event)
{
    EntityItem entityItem = event.getItem();
    ItemStack stack = entityItem.getItem();
    EntityPlayer player = event.getEntityPlayer();

    if (player.getEntityWorld().isRemote || entityItem.isDead || stack.isEmpty())
    {
        return true;
    }

    ItemStack origStack = ItemStack.EMPTY;
    final int origStackSize = stack.getCount();
    int stackSizeLast = origStackSize;
    boolean ret = false;

    IItemHandler playerInv = player.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
    // Not all the items could fit into existing stacks in the player's inventory, move them directly to the bag
    List<Integer> slots = InventoryUtils.getSlotNumbersOfMatchingItems(playerInv, EnderUtilitiesItems.HANDY_BAG);

    for (int slot : slots)
    {
        ItemStack bagStack = playerInv.getStackInSlot(slot);

        // Bag is not locked
        if (bagStack.isEmpty() == false && bagStack.getItem() == EnderUtilitiesItems.HANDY_BAG && ItemHandyBag.bagIsOpenable(bagStack))
        {
            // Delayed the stack copying until we know if there is a valid bag,
            // so check if the stack was copied already or not.
            if (origStack == ItemStack.EMPTY)
            {
                origStack = stack.copy();
            }

            stack = handleItems(stack, bagStack, player);

            if (stack.isEmpty() || stack.getCount() != stackSizeLast)
            {
                if (stack.isEmpty())
                {
                    entityItem.setDead();
                    event.setCanceled(true);
                    ret = true;
                    break;
                }

                ItemStack pickedUpStack = origStack.copy();
                pickedUpStack.setCount(stackSizeLast - stack.getCount());

                FMLCommonHandler.instance().firePlayerItemPickupEvent(player, entityItem, pickedUpStack);
                player.onItemPickup(entityItem, origStackSize);
            }

            stackSizeLast = stack.getCount();
        }
    }

    // Not everything was handled, update the stack
    if (entityItem.isDead == false && stack.getCount() != origStackSize)
    {
        entityItem.setItem(stack);
    }

    // At least some items were picked up
    if (entityItem.isSilent() == false && (entityItem.isDead || stack.getCount() != origStackSize))
    {
        player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.MASTER,
                0.2F, ((itemRand.nextFloat() - itemRand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
    }

    return ret;
}
 
Example 20
/**
 * Try to handle the items being picked up.
 * @param event
 * @return true to prevent further processing of the event
 */
public static boolean onEntityItemPickupEvent(EntityItemPickupEvent event)
{
    EntityItem entityItem = event.getItem();
    ItemStack stack = entityItem.getItem();
    EntityPlayer player = event.getEntityPlayer();

    if (player.getEntityWorld().isRemote || entityItem.isDead || stack.isEmpty())
    {
        return true;
    }

    ItemStack origStack = ItemStack.EMPTY;
    final int origStackSize = stack.getCount();
    List<ItemStack> managers = getEnabledItems(player);
    // If there are enabled managers in the player's inventory, then initialize to "deny"
    boolean deny = managers.size() > 0;

    //int i = 0;
    for (ItemStack manager : managers)
    {
        // Delayed the stack copying until we know if there is a valid bag,
        // so check if the stack was copied already or not.
        if (origStack == ItemStack.EMPTY)
        {
            origStack = stack.copy();
        }

        Result result = ((ItemPickupManager) manager.getItem()).handleItems(player, manager, stack);

        //System.out.println("i: " + i++ + " result: " + result);
        // Blacklisted or successfully transported, cancel further processing
        if (result == Result.BLACKLISTED || result == Result.TRANSPORTED)
        {
            if (result == Result.TRANSPORTED)
            {
                entityItem.setDead();
            }

            deny = true;
            break;
        }

        // Whitelisted, no need to check any further managers, just allow picking it up
        if (result == Result.WHITELISTED)
        {
            deny = false;
            break;
        }

        // Filters disabled or filtering mode was black list, and the item was not on the black list => allow through
        if (result == Result.NOT_HANDLED || result == Result.NOT_BLACKLISTED)
        {
            deny = false;
        }
    }

    // At least some items were picked up
    if (stack.getCount() != origStackSize || entityItem.isDead)
    {
        if (entityItem.isSilent() == false)
        {
            player.getEntityWorld().playSound(null, player.getPosition(), SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.MASTER, 0.2F,
                    ((player.getEntityWorld().rand.nextFloat() - player.getEntityWorld().rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        }

        if (stack.isEmpty() || entityItem.isDead)
        {
            FMLCommonHandler.instance().firePlayerItemPickupEvent(player, entityItem, origStack);
            player.onItemPickup(entityItem, origStackSize);
        }
    }

    if (deny)
    {
        event.setCanceled(true);
    }

    return deny;
}