Add-Ons

From Better Than Wolves Wiki
Revision as of 00:39, 8 June 2016 by MagikEh (talk | contribs) (Fucked up the boiler plate bad, fixed.)
Jump to: navigation, search

For Add-Ons there's special section on the BTW forums: http://www.sargunster.com/btwforum/viewforum.php?f=12

How to create an Add-On

Addons are currently in a state of standstill. FlowerChild has to give permission for addons to be distributed. More linkies to the situation

Setting Up

(This tutorial is being done on a win7 x64 machine.)

  • Lets start by installing some things:
    1. Java JDK
      • Grab the latest Java se JDK from here.
      • Download and install the proper version for your computer.
      • Make sure that the paths are set, more information on paths can be found here.
    2. MCP v.7.51 for Minecraft 1.5.2
    3. Vanilla Minecraft .jars
    4. Latest BTW version
    5. Latest Eclipse
      • This is my preferred IDE, if you have one that you like more, then please feel free to use it instead.
      • Get the latest version of the IDE here.
      • Unzip the downloaded file to the preferred install location.
  • Next we will unzip the 'mcp751.zip' file to the desired location.
  • Shove the minecraft_server.jar from earlier into the 'mcp751/jars' folder.
  • Now for a tricky part, we require the assets and such from the 1.52 version of minecraft. To do this go to your favorite minecraft launcher and create a new profile/instance for 1.52 (remember you have the 1.52 .jar if you need it)
  • Run the 1.52 instance right to the load game menu. Exit minecraft then go to your .minecraft folder (usually located in %appdata&)
  • Copy out the '.minecraft/bin' and '.minecraft/resources' folder into the 'mcp751/jars' folder.
  • Install the BTW mod into the 'mcp751/jars/minecraft_server.jar' and the 'mcp751/jars/minecraft.jar'
  • Run the 'mcp751/decompile.bat' file and wait for the interface to ask for a keypress to continue (this process can take anywhere from 1-30 minutes)
  • There should be a couple errors, this is perfectly normal. Next we will setup eclipse.
  • Start Eclipse, then when prompted for a workspace point it to 'mcp751/eclipse'
  • Now we need to get rid of those pesky errors. Find the classes that are erroring out
    1. 'Client/src/net.minecraft.src/EntityAnimal.java'
    2. 'Client/src/net.minecraft.src/EntityGhast.java'
    3. 'Server/src/net.minecraft.src/EntityAnimal.java'
    4. 'Server/src/net.minecraft.src/EntityGhast.java'
    • Now in the EntityAnimal file the methods 'setRevengeTarget' and 'OnNearbyAnimalAttacked' need 'this.breeding' to be changed to 'entityLivingToAttack'.
    • And in the EntityGhast file the method updateEntityActionState() need to have '&& var9 != this.waypointZ' removed from the if() statement.
    • Props to six for finding this out.
  • Save and exit the edited classes.
  • Go back and run 'mcp751/recompile.bat'
  • When it is finished recompiling run the 'mcp751/updatemd5.bat'

You should now be ready to create an addon for the BTW Mod.

Creating an Add-On

Official forum post on Add-Ons creation. We will need to create a base class to instantiate our add-on with. Make sure to have your main class extend the 'FCAddOn' class. This should be a good boilerplate for an add-on class.

package net.minecraft.src;

public class YOUR_CLASS_NAME_HERE extends FCAddOn
{
    protected FCAddOn()
    {
        FCAddOnHandler.AddMod(this);
    }

    public void PreInitialize() {}

    public abstract void Initialize();

    public void PostInitialize() {}

    public void OnLanguageLoaded(StringTranslate var1) {}
}

Another hitch in the whole creation of an Add-On is that in order for the JVM to even look at our class we need some other portion of the code (any other VMC class basically) to point or somehow look at our code.(make a request/call) This will tell the JVM that there is a class that needs to be loaded, and when game time comes we will have a working mod.

From here on out I will leave you kiddies to your business and allow you to create the most beautiful monstrosities around.

Obfuscation

  • Decompile the code, modify and recompile.
  • Start "reobfuscate.bat" to start the reobfuscation step, it will automatically detect changed classes and reobfuscate them.
  • Your obfuscated classes are now available in 'mcp751\reobf\minecraft' and 'mcp751\reobf\minecraft_server', ready to be injected in MC.

Final Notes

For any other information on how to use the mcp refer to the docs file in 'mcp751\docs\README-MCP.TXT'