Add-Ons

From Better Than Wolves Wiki
Revision as of 23:35, 5 March 2019 by ExpHP (talk | contribs) (update for 4.B00)
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/bin/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.(It might also say "Decompiling failed" just continue) 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,Server}/src/net.minecraft.src/EntityAnimal.java
      • The methods setRevengeTarget, OnNearbyAnimalAttacked, OnNearbyPlayerStartles need all instances of this.breeding to be changed to this.entityLivingToAttack.
      • Props to six for finding this out.
    2. {Client,Server}/src/net.minecraft.src/FCEntityGhast.java
      • The method updateEntityActionState needs to have && var9 != this.waypointZ removed from the if() statement.
    3. {Client,Server}/src/net.minecraft.src/AxisAlignedBB
      {Client,Server}/src/net.minecraft.src/EntityMooshroom
      {Client,Server}/src/net.minecraft.src/FCEntityChicken
      {Client,Server}/src/net.minecraft.src/FCEntityCow
      {Client,Server}/src/net.minecraft.src/FCEntityOcelot
      {Client,Server}/src/net.minecraft.src/FCEntityPig
      {Client,Server}/src/net.minecraft.src/FCEntityVillager
      {Client,Server}/src/net.minecraft.src/FCEntityWolf
      {Client,Server}/src/net.minecraft.src/FCModelBlock
      {Client,Server}/src/net.minecraft.src/FCUtilsPrimitiveAABBWithBenefits
      {Client,Server}/src/net.minecraft.src/FCUtilsPrimitiveQuad
      
      • These classes all have a duplicate method (and FCUtilsPrimitiveAABBWithBenefits has two). In the animals it is called spawnBabyAnimal; in the Villager it is called func_90012_b.
      • Delete the copies whose bodies appear to be calling themselves recursively.
      • As of BTW 4.B00-b with MCP 7.51, the ones you want to delete are at the very bottom of the class in all cases.
    4. {Client,Server}/src/net.minecraft.src/EntityVillager
      • In setRevengeTimer you must make two edits:
        • Replace this.randomTickDivider with this.entityLivingToAttack.
        • Replace all instances of this.isMating with this.revengeTimer.
    5. Client/src/net.minecraft.src/EntityVillager
      • In doSpawnParticle, change the type of var21 from Object to EntityFX.
  • 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'