Created
May 14, 2012 16:58
-
-
Save psxlover/2695062 to your computer and use it in GitHub Desktop.
ISetBlockHandler hook example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package net.minecraft.src; | |
import net.minecraft.src.forge.ISetBlockHandler; | |
import net.minecraft.src.forge.MinecraftForge; | |
public class mod_ProtectSpawnFromTNT extends BaseMod implements ISetBlockHandler { | |
@Override | |
public boolean onBlockBeingPlaced(World w, int x, int y, int z, int blockID, int metadata) { | |
WorldInfo wI = w.worldInfo; | |
if (blockID == 46 && Math.abs(wI.getSpawnX() - x) < 100 && Math.abs(wI.getSpawnZ() - z) < 100) { | |
return true; | |
} | |
return false; | |
} | |
@Override | |
public String getVersion() { | |
return "0"; | |
} | |
@Override | |
public void load() { | |
MinecraftForge.registerSetBlockHandler(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment