Add-Ons
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:
- Java JDK
- MCP v.7.51 for Minecraft 1.5.2
- Download the MCP from here. (Direct link if website is down.)
- Vanilla Minecraft .jars
- Latest BTW version
- Snag the latest BTW version from the BTW forums.
- 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 themcp751/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 themcp751/jars
folder. - Install the BTW mod into the
mcp751/jars/minecraft_server.jar
and themcp751/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
-
{Client,Server}/src/net.minecraft.src/EntityAnimal.java
- The methods
setRevengeTarget
,OnNearbyAnimalAttacked
,OnNearbyPlayerStartles
need all instances ofthis.breeding
to be changed tothis.entityLivingToAttack
. - Props to six for finding this out.
- The methods
-
{Client,Server}/src/net.minecraft.src/FCEntityGhast.java
- The method
updateEntityActionState
needs to have&& var9 != this.waypointZ
removed from theif()
statement.
- The method
-
{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 calledspawnBabyAnimal
; in the Villager it is calledfunc_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.
- These classes all have a duplicate method (and
-
{Client,Server}/src/net.minecraft.src/EntityVillager
- In
setRevengeTimer
you must make two edits:- Replace
this.randomTickDivider
withthis.entityLivingToAttack
. - Replace all instances of
this.isMating
withthis.revengeTimer
.
- Replace
- In
-
Client/src/net.minecraft.src/EntityVillager
- In
doSpawnParticle
, change the type ofvar21
fromObject
toEntityFX
.
- In
-
- 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'