Thursday 26 December 2013

Forge concepts - extra methods for vanilla base classes

In a number of cases, Forge has added extra methods to the base classes, or sometimes moved methods from a core class (eg World) to a different class which can be extended and registered (eg WorldProvider). These forge methods are generally very easy to spot because
  • They are usually moved to the end of the class, placed after a comment like /*===========Forge Start ========*/
  • The JavaDoc documentation (before each class declaration) is usually much better than the rest of the vanilla code.

A number of the extra methods have been added as completely separate interfaces, for example IPlantable for plants and IShearable for entities which can be shorn.


Forge adds a few completely new classes and methods to make life easier-
  • Fluids:- A variety of classes to let you define your own fluids (like lava and water) and control their behaviour; comprised of BlockFluidBase, BlockFluidClassic, Fluid and FluidStack.
  • Models: A few classes related to rendering, not actually sure if they’re ever used since it seems people nearly always use Techne and that appears to use vanilla Models.
  • Ores: OreDictionary, ShapedOreRecipes, ShapelessOreRecipes - As far as I can tell, this lets you make recipes using ores provided by other mods, in particular BuildCraft.
  • RotationHelper: a couple of functions to help rotate vanilla blocks to face the desired direction (eg piston, doors, etc), convert from the block’s metadata to a standard “direction value”.
  • Configuration: class to help you create configuration files to store settings for your mod

Forge also adds a number of packets with base class ForgePackets or FMLPacket, they act “behind the scenes” and you’re unlikely to use them directly.



~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