Jump to content

Recommended Posts

Posted

Hello.

 

I've created a Pickup Handler, but it looks like that this Pickup Handler won't load.

Common Proxy

 

@Override
public void registerEventHooks()
{
	FMLCommonHandler.instance().bus().register(new PlayerDimensionEventHook());
	FMLCommonHandler.instance().bus().register(new PlayerPickupEventHook());
	FMLCommonHandler.instance().bus().register(new PlayerEventHook());

	MinecraftForge.EVENT_BUS.register(new BonemealEventHook());
	//MinecraftForge.EVENT_BUS.register(new PlayerPickupEventHook());

	GameRegistry.registerFuelHandler(new FFuelHandler());
}

 

(I tested it with both, MinecraftForge.EVENT_BUS.register and FMLCommonHandler.instance().bus().register)

 

PlayerPickupEventHook

 

package minecraftplaye.primevalforest.event;

import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import minecraftplaye.primevalforest.achievement.PFAchievementPage;
import minecraftplaye.primevalforest.blocks.PFBlocks;
import net.minecraft.item.ItemStack;

public class PlayerPickupEventHook
{
   
/**
     * Checks if the player picks an Item or Block up!
     * 
     * @param event The MCForge ItemPickupEvent
     */
@SideOnly(Side.SERVER)
@SubscribeEvent(priority = EventPriority.NORMAL)
public void notifyPickup(PlayerEvent.ItemPickupEvent  event)
{
	System.out.println("YOLO");
	if(event.pickedUp.getEntityItem().isItemEqual(new ItemStack(PFBlocks.port_sapling)))
	{
		System.out.println("YOLO2");
		event.player.triggerAchievement(PFAchievementPage.forgotten_sapling);
		event.player.addExperience(25);
	}
}
}

 

 

I'm using Forge 1.7.2-10.12.1.1103.

 

EDIT: Ok, I solved it, forgot to remove the SideOnly... in the Event class

Bektor

Developer of Primeval Forest.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.