Skip to content

Latest commit

 

History

History
52 lines (36 loc) · 2.12 KB

README.md

File metadata and controls

52 lines (36 loc) · 2.12 KB

BlockBreak Event for MinecraftForge

This adds an API for modders to use to listen for a block being broken.

The transformer itself was written by bspkrs for use in his treecaptitator mod.

For modders: You simply need to register a forge event handler the usual way, with a BlockBreakEvent as the argument, for example:

@ForgeSubscribe
public void onBlockBreak(PlayerBreakBlockEvent ev) {
	System.out.println("Break!");
}

and then to register, MinecraftForge.EVENT_BUS.register(new ForgeEventHandler()) in your init. Replace 'ForgeEventHandler()' with the name of your event handling class.

To test your code, place the nin.jar in your coremods folder.

Note that it IS cancellable!

Setting up your MCP

Decompile forge, etc as usual. Copy the source/keepcalm folder into mcp/src/minecraft.

You will need two property files from BukkitForge and put them into mcp/src/minecraft as well (NullPointerException will be thrown on start up otherwise):

cd mcp/src/minecraft
wget https://github.com/keepcalm/BukkitForge/raw/master/utils/mcp.properties
wget https://github.com/keepcalm/BukkitForge/raw/master/utils/obf.properties

Place the BlockBreakNin.jar into mcp/jars/coremods.

Note for eclipse: If you get some visibility errors - just change the visibility of the claimed fields to public.

Including the code in your mod

Easiest way to do this at present is to copy all the files in src/ (except BlockBreakContainer) into your mod, and add the META-INF to the mod's jar, and distribute as a coremod. Please credit me in your forum post/your mcmod.info

Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.