This is how I do it in my Pickup Control mod:
package mpmod.common;
import mpmod.client.MPKeyHandler;
import mpmod.utils.PickupSettings;
import mpmod.utils.PlayerHandler;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PickupEventHandler {
// ////////////The Main Event///////////////
@SubscribeEvent
public void EntityItemPickupEvent(EntityItemPickupEvent evt)
{
EntityPlayer player = evt.entityPlayer;
EntityItem item = evt.item;
System.out.println("PickupEvent Fired!" + evt.entityPlayer.worldObj.isRemote);
if (player != null && item != null)
{
if (PickupSettings.allowAlreadyStackedItems)
{
if (PlayerHandler.checkPlayerHasItem(item, player))
{
return;
}
}
switch (PickupSettings.pickupMode)
{
case AUTO:
{
return;
}
case MANUAL:
{
if (MPKeyHandler.pickupItemKey.getIsKeyPressed())
{
return;
}
}
case INDIVIDUAL:
{
if (PlayerHandler.isPlayerLookingAt(item, player) && MPKeyHandler.pickupItemKey.getIsKeyPressed())
{
return;
}
}
}
evt.setCanceled(true);
System.out.println("PickupEvent blocked!");
}
}
}
Register a class similar to this with MinecraftForge.EventBus. This blocks all pickups based on the state I have set. You could just read the input directly from Keyboard, and allow the event to happen when the right mouse key is pressed. No bother with overriding and all that.
HOWEVER, this will ONLY work in singleplayer. I really really wish this could just be a clientside mod. You would think it would be easy. Unfortunately, this event is only called serverside and I haven't gotten around to figuring out a packet system to enable multiplayer support.