-
Notifications
You must be signed in to change notification settings - Fork 0
Forge Client Sided Events
John Doe edited this page Mar 13, 2022
·
1 revision
The following classes are from the package net.minecraftforge.client.event in the library forgeSrc-1.8.9-11.15.1.2318-1.8.9.jar. They all should have the annotations @SideOnly(Side.CLIENT) and need to have the annotation @SubscribeEvent when used in a method body of a class that has been registered in the MinecraftForge.EVENT_BUS.
-
Trigger: When the server sent a chat message. Both the player chat (type
0) and the messages directly over the hotbar (type2) count to those. -
Attributes:
event.typeas explained above andevent.messageas the formated text displayed.
-
Trigger: Whenever a GUI shows up. One usecase would be the
GuiChestelement in theevent.guiof theGuiScreenEvent.InitGuiEvent.Postevent. -
Attributes:
event.guicontains the gui element that triggered the event. This could, from the example above, be aGuiChest, in which case the following command would return the inventory of the chestIInventory chestInventory = ((ContainerChest) ((GuiChest) event.gui).inventorySlots).getLowerChestInventory() - Notes: It is recommended to wait a few milliseconds (somewhere around 50ms should be good, maybe even more) after this event, before the chest inventory is analysed, to wait for it to fully load its contents.
- Trigger: Whenever there is a sound played in the world.
-
Attributes:
event.nameis a String that represents the sound. A list of those can be found here.event.soundcontains things like the pitch, volume and sound location.
- Trigger: Every frame.
-
Attributes:
event.partialTicksis important for the render functions theRenderUtilfrom Moulberry provide.
- Trigger: Left mouse click
-
Attributes:
event.button- 0 left, 1 right, 2 middle click - Note: There are a few problems with this where it doesnt work with right click...
DrawBlockHighlightEvent EntityViewRenderEvent FOVUpdateEvent GuiOpenEvent ModelBakeEvent RenderBlockOverlayEvent RenderGameOverlayEvent RenderHandEvent RenderItemInFrameEvent RenderLivingEvent RenderPlayerEvent RenderWorldEvent TextureStitchEvent