Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BlockRiot.java:
- package net.minecraft.src;
- import java.util.Map;
- import java.util.Random;
- import net.minecraft.client.Minecraft;
- // Referenced classes of package net.minecraft.src:
- // World, ItemStack, KeyBinding, EntityPlayer,
- // GuiScreen, RenderBlocks, Block, IBlockAccess,
- // IInventory
- public class BlockRiot extends Block
- {
- protected BlockRiot(int i, int j)
- {
- super(i,j,Material.wood);
- }
- public int quantityDropped(Random random)
- {
- if(random.nextInt(6)== 0)
- {
- return 2;
- }else
- {
- return 1;
- }
- }
- public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
- {
- if (world.multiplayerWorld)
- {
- return true;
- }
- else
- {
- entityplayer.displayWorkbenchGUI(i, j, k);
- return true;
- }
- }
- }
- mod_riot.java:
- package net.minecraft.src;
- import java.util.Random;
- public class mod_riot extends BaseMod
- {
- public static final Block blockriot = new BlockRiot(200, 0).setHardness(0.9F).setResistance(1F).setBlockName("Riot-Inducing Block");
- public static final Item riotstick = new ItemSword(3333,EnumToolMaterial.RIOT).setItemName("riot stick");
- public mod_riot()
- {
- }
- public String Version()
- {
- return "Tutorial";
- }
- public String getVersion()
- {
- return "1.0.0";
- }
- public void load()
- {
- //icon index
- blockriot.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/icons/blkr.png");
- riotstick.iconIndex = ModLoader.addOverride("/gui/items.png", "/icons/RS.png");
- //recipes
- ModLoader.AddRecipe(new ItemStack(blockriot,1), new Object[]{
- "**", Character.valueOf('*'), Block.dirt
- });
- ModLoader.AddRecipe(new ItemStack(riotstick,1),new Object[]{
- "*","*","*", Character.valueOf('*'), Block.dirt
- });
- //Names
- ModLoader.AddName(blockriot, "Riot-Inducing Block");
- ModLoader.AddName(riotstick, "Riot Stick");
- //Registers
- ModLoader.RegisterBlock(Blkr);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement