Advertisement
riking

Untitled

Jan 21st, 2012
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. BlockRiot.java:
  2. package net.minecraft.src;
  3.  
  4. import java.util.Map;
  5. import java.util.Random;
  6. import net.minecraft.client.Minecraft;
  7.  
  8. // Referenced classes of package net.minecraft.src:
  9. // World, ItemStack, KeyBinding, EntityPlayer,
  10. // GuiScreen, RenderBlocks, Block, IBlockAccess,
  11. // IInventory
  12.  
  13. public class BlockRiot extends Block
  14. {
  15.  
  16. protected BlockRiot(int i, int j)
  17. {
  18. super(i,j,Material.wood);
  19. }
  20. public int quantityDropped(Random random)
  21. {
  22. if(random.nextInt(6)== 0)
  23. {
  24. return 2;
  25. }else
  26. {
  27. return 1;
  28. }
  29. }
  30. public boolean blockActivated(World world, int i, int j, int k, EntityPlayer entityplayer)
  31. {
  32. if (world.multiplayerWorld)
  33. {
  34. return true;
  35. }
  36. else
  37. {
  38. entityplayer.displayWorkbenchGUI(i, j, k);
  39. return true;
  40. }
  41. }
  42.  
  43.  
  44. }
  45.  
  46. mod_riot.java:
  47. package net.minecraft.src;
  48. import java.util.Random;
  49.  
  50.  
  51. public class mod_riot extends BaseMod
  52. {
  53. public static final Block blockriot = new BlockRiot(200, 0).setHardness(0.9F).setResistance(1F).setBlockName("Riot-Inducing Block");
  54. public static final Item riotstick = new ItemSword(3333,EnumToolMaterial.RIOT).setItemName("riot stick");
  55.  
  56. public mod_riot()
  57. {
  58.  
  59. }
  60.  
  61. public String Version()
  62. {
  63. return "Tutorial";
  64. }
  65.  
  66. public String getVersion()
  67. {
  68. return "1.0.0";
  69. }
  70.  
  71. public void load()
  72. {
  73. //icon index
  74. blockriot.blockIndexInTexture = ModLoader.addOverride("/terrain.png", "/icons/blkr.png");
  75. riotstick.iconIndex = ModLoader.addOverride("/gui/items.png", "/icons/RS.png");
  76. //recipes
  77.  
  78. ModLoader.AddRecipe(new ItemStack(blockriot,1), new Object[]{
  79. "**", Character.valueOf('*'), Block.dirt
  80. });
  81. ModLoader.AddRecipe(new ItemStack(riotstick,1),new Object[]{
  82. "*","*","*", Character.valueOf('*'), Block.dirt
  83. });
  84. //Names
  85. ModLoader.AddName(blockriot, "Riot-Inducing Block");
  86. ModLoader.AddName(riotstick, "Riot Stick");
  87. //Registers
  88. ModLoader.RegisterBlock(Blkr);
  89. }
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement