Posted January 10, 201411 yr is there an event list for forge on 1.7.2? I can only find outdated ones, and I'm not the type of person who has toooooooooo much information about Forge.
January 10, 201411 yr In this same vein, seeing some sample/tutorial code specifically pertaining to 1.7.2 would be awesome for us noobs. Although I am slowly patching things together.
January 10, 201411 yr You can just type Event. and wait for your IDE to autofill with Events, they are all pretty self explanatory. You can also download the Javadoc. The ones below are taken directly from the Javadocs. InputEvent.KeyInputEvent InputEvent.MouseInputEvent PlayerEvent.ItemCraftedEvent PlayerEvent.ItemPickupEvent PlayerEvent.ItemSmeltedEvent PlayerEvent.PlayerChangedDimensionEvent PlayerEvent.PlayerLoggedInEvent PlayerEvent.PlayerLoggedOutEvent PlayerEvent.PlayerRespawnEvent TickEvent.ClientTickEvent TickEvent.PlayerTickEvent TickEvent.RenderTickEvent TickEvent.ServerTickEvent TickEvent.WorldTickEvent As for some sample code... @EventHandler public void preInit(FMLPreInitializationEvent event) { FMLCommonHandler.instance().bus().register(new ExampleEvent()); } public class TestEvent { @SubscribeEvent public void onItemPickup(PlayerEvent.ItemPickupEvent event) { System.out.println("You just picked up: " + event.pickedUp.toString()); } }
January 10, 201411 yr You can just type Event. and wait for your IDE to autofill with Events, they are all pretty self explanatory. You can also download the Javadoc. The ones below are taken directly from the Javadocs. InputEvent.KeyInputEvent InputEvent.MouseInputEvent PlayerEvent.ItemCraftedEvent PlayerEvent.ItemPickupEvent PlayerEvent.ItemSmeltedEvent PlayerEvent.PlayerChangedDimensionEvent PlayerEvent.PlayerLoggedInEvent PlayerEvent.PlayerLoggedOutEvent PlayerEvent.PlayerRespawnEvent TickEvent.ClientTickEvent TickEvent.PlayerTickEvent TickEvent.RenderTickEvent TickEvent.ServerTickEvent TickEvent.WorldTickEvent As for some sample code... @EventHandler public void preInit(FMLPreInitializationEvent event) { FMLCommonHandler.instance().bus().register(new ExampleEvent()); } public class TestEvent { @SubscribeEvent public void onItemPickup(PlayerEvent.ItemPickupEvent event) { System.out.println("You just picked up: " + event.pickedUp.toString()); } } i thought there was more events then that
January 10, 201411 yr There are lots of them: https://github.com/MinecraftForge/MinecraftForge/tree/master/src/main/java/net/minecraftforge/event Explore Forge source code more often. Before you even think about modding, please learn basic Java.
January 11, 201411 yr It should be noted that events derived from net.minecraftforge must be registered using: MinecraftForge.EVENT_BUS.register(new CustomEvent()); Whereas events derived from cpw.mods.fml.common.gameevent must be registered using: FMLCommonHandler.instance().bus().register(new CustomEvent());
February 4, 201411 yr I noticed that the PlayerEvent.PlayerLoggedOutEvent is not called when you quit the game, i tested it in both single and multiplayer. But PlayerEvent.PlayerRespawnEvent works actually Is there another event to use when you logout and quit the game to save config and such...
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.