Thursday 26 December 2013

Forge - Miscellaneous stuff – player input, rendering, GUI, chat, sounds

Player Input

  • KeyBindingRegistry – allows you to add your own keybindings to the vanilla ones – (for example some vanilla keybindings are A for left and D for right).  Your custom keybindings will appear on the options page so that the player can change them.
  • MouseEvent – allows you to intercept mouse clicks and mouse movement before the vanilla code sees it.

Rendering

A lot of the custom stuff related to rendering has been covered in the other sections, however there are also quite a few other events related to rendering, listed below:

  • Various events used to customise Biome-dependent rendering, such as grass colour – see BiomeEvent.
  • FOVUpdateEvent (FOV = Field of View, which means how “wide” your view is)
  • RenderGameOverlayEvent gets called for a whole stack of different parts of the screen overlay, such as hotbar, crosshairs, health bar, etc.  See enum ElementType in the event for more information.
  • DrawBlockHighlightEvent – draw the highlight box around the block when your cursor is pointing at it
  • Another bundle of Events under RenderLivingEvent and RenderPlayerEvent can be used to control the rendering of the player and other entities in quite some detail.

Graphical User Interface

I’m a bit rubbish on this section because I’ve never actually customised a GUI.  From what I can tell, there are a few forge-related additions:
  • AchievementPage.registerAchievementPage lets you add your own achievement pages.
  • NetworkRegistry.registerGuiHandler (using IGuiHandler) – not sure how to use this.
  • GuiIngameForge – replace vanilla in-game overlays with many extra events, and also adds a large number of  flags you can change to turn rendering of HUD elements on/off – for example hotbar, crosshairs, helmet, experience bar, etc.
  • GuiControlsScrollPanel – accommodates any extra key bindings you have added to the KeyBindingRegistry
  • GuiOpenEvent – used to replace a GUI with your own customised version
  • PlayerOpenContainerEvent – when opening a GUI container.

Chat

There are a few interesting events related to chat:
  • NetworkRegistry.registerChatListener(using  IChatListener) for intercepting chat messages including commands
  • NetworkRegistry.registerConnectionHandler(IConnectionHandler) which gives control over clients and players connecting to the server.
  • CommandEvent
  • ServerChatEvent
  • ClientChatReceivedEvent

Sounds

Sounds are registered using SoundLoadEvent  instead of a registry call.  Don’t ask me why.  They are played using using vanilla methods such as SoundManager.playSound.  Some related events are
  • SoundSetupEvent
  • PlayBackgroundMusicEvent
  • PlaySoundEffectEvent
  • PlaySoundEffectSourceEvent
  • PlaySoundEvent
  • PlaySoundSourceEvent
  • PlayStreamingEvent
  • PlayStreamingSourceEvent
  • PlaySoundAtEntityEvent


~Overview of Forge (and what it can do for you)
    Forge concepts
           Some general notes
           How Forge starts up your code (@Mod, @SidedProxy, etc)  
           Registering your classes
           Extra methods for vanilla base classes
           Events
     Forge summary - grouped by task
           Blocks
           Items
           TileEntities
           Entities
           World generation, loading, saving
           Miscellaneous - player input, rendering, GUI, chat, sounds

No comments:

Post a Comment