Warung Bebas

Kamis, 26 Desember 2013

Forge concepts - some general notes

Forge is comprised of a couple of main components
  • FML � forge mod loader � which is mostly concerned with loading mods and initialising them, but also provides most of the Registries.
  • Minecraftforge � adds a large number of extra events and hooks
They were developed independently and are stored in different packages (cpw.mods.fml vs net.minecraftforge), but apart from that you�ll use them in the same way. The biggest symptom you might notice is that the paradigms are sometimes a bit inconsistent � naming conventions, hook methods, event handlers, commenting style � but nothing too hard to get used to.

Often it is difficult to know exactly which forge methods or hooks are going to be useful to create the behaviour you want.  A general strategy I have found effective is:
  1. Think of a part of the vanilla minecraft which does something similar to what you want to do.
  2. Open up that item, block, entity (or whatever) and browse through the vanilla code to see how it works.
  3. Look for ways to divert the program flow to your own code:
    * Methods that you can override in your own classes (especially for Blocks, Items, Entities)
    * A forge event or hook inserted into the vanilla code, which you can register for.
Sometimes, if there is no appropriate event or class method to override, it is possible to check for a condition using a tickhandler (called 20 times per second) and act on that � for example, checking if the player is holding a particular item in their hand and making sparks fly from their head if it is.



~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

0 komentar em “Forge concepts - some general notes”

Posting Komentar

 

My Blog Copyright © 2012 Fast Loading -- Powered by Blogger