PageRenderTime 149ms CodeModel.GetById 28ms RepoModel.GetById 0ms app.codeStats 0ms

/scclient/mod_ServerCurrency.java

https://bitbucket.org/Mikerman50/currency_update1.2.5
Java | 180 lines | 160 code | 15 blank | 5 comment | 16 complexity | a338d20fc42cbad5700f279b8fe8679c MD5 | raw file
  1. // Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
  2. // Jad home page: http://www.kpdus.com/jad.html
  3. // Decompiler options: packimports(3) braces deadcode fieldsfirst
  4. package net.minecraft.src;
  5. import net.minecraft.client.Minecraft;
  6. import net.minecraft.src.forge.*;
  7. import net.minecraft.src.forge.Configuration;
  8. import java.util.*;
  9. import java.util.logging.Logger;
  10. import java.io.*;
  11. import java.io.IOException;
  12. import cpw.mods.fml.common.modloader.ModLoaderHelper;
  13. import java.lang.reflect.Field;
  14. import java.net.*;
  15. public class mod_ServerCurrency extends NetworkMod
  16. {
  17. public static String modName = "Server Currency";
  18. public static String versionNumber = "0.52 MCPC";
  19. public static Logger logger = Logger.getLogger("Minecraft");
  20. public static mod_ServerCurrency instance;
  21. public static int stoneBlankID;
  22. public static int ironBlockID;
  23. public static int goldBlankID;
  24. public static int quincunxID;
  25. public static int denariID;
  26. public static int aureusID;
  27. public static int woodDieID;
  28. public static int stoneDieID;
  29. public static int ironDieID;
  30. public static int diamondDieID;
  31. public static int coinerID = 200;
  32. // public static int coinerGUI = 98;
  33. public static final Item stoneBlank;
  34. public static final Item ironBlank;
  35. public static final Item goldBlank;
  36. public static final Item dupondius;
  37. public static final Item denarius;
  38. public static final Item aureus;
  39. public static final Item woodDie;
  40. public static final Item stoneDie;
  41. public static final Item ironDie;
  42. public static final Item diamondDie;
  43. public static final Block coiner;
  44. public String Version()
  45. {
  46. return versionNumber;
  47. }
  48. public static final Achievement currency;
  49. public static int coinfront = ModLoader.addOverride("/terrain.png", "/ServerCurrency/Coiner/coinidle.png");
  50. public mod_ServerCurrency()
  51. {
  52. instance = this;
  53. }
  54. public void load()
  55. {
  56. {
  57. ModLoader.registerBlock(coiner);
  58. ModLoader.addName(dupondius, "Quincunx");
  59. ModLoader.addName(denarius, "Denarii");
  60. ModLoader.addName(aureus, "Aureus");
  61. ModLoader.addName(stoneBlank, "Stone Blank");
  62. ModLoader.addName(ironBlank, "Iron Blank");
  63. ModLoader.addName(goldBlank, "Gold Blank");
  64. ModLoader.addName(woodDie, "Wooden Die");
  65. ModLoader.addName(stoneDie, "Stone Die");
  66. ModLoader.addName(ironDie, "Iron Die");
  67. ModLoader.addName(diamondDie, "Diamond Die");
  68. ModLoader.addName(coiner, "Coining Mint");
  69. stoneBlank.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/blankbronze.png");
  70. ironBlank.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/blankiron.png");
  71. goldBlank.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/blankgold.png");
  72. dupondius.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/dupondius.png");
  73. denarius.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/denarius.png");
  74. aureus.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/aureus.png");
  75. woodDie.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/wooddie.png");
  76. stoneDie.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/stonedie.png");
  77. ironDie.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/irondie.png");
  78. diamondDie.iconIndex = ModLoader.addOverride("/gui/items.png", "/ServerCurrency/diamonddie.png");
  79. ModLoader.addRecipe(new ItemStack(coiner, 1), new Object[] {
  80. "WDW", "IPI", "III", Character.valueOf('I'), Item.ingotIron, Character.valueOf('W'), Block.planks, Character.valueOf('P'), Block.pistonBase, Character.valueOf('D'),
  81. ironDie
  82. });
  83. ModLoader.addRecipe(new ItemStack(stoneBlank, 1), new Object[] {
  84. " C ", "C C", " C ", Character.valueOf('C'), Block.cobblestone
  85. });
  86. ModLoader.addRecipe(new ItemStack(ironBlank, 1), new Object[] {
  87. " I ", "I I", " I ", Character.valueOf('I'), Item.ingotIron
  88. });
  89. ModLoader.addRecipe(new ItemStack(goldBlank, 1), new Object[] {
  90. " G ", "G G", " G ", Character.valueOf('G'), Item.ingotGold
  91. });
  92. ModLoader.addRecipe(new ItemStack(woodDie, 1), new Object[] {
  93. "# #", " # ", "# #", Character.valueOf('#'), Block.planks
  94. });
  95. ModLoader.addRecipe(new ItemStack(stoneDie, 1), new Object[] {
  96. "# #", " # ", "# #", Character.valueOf('#'), Block.cobblestone
  97. });
  98. ModLoader.addRecipe(new ItemStack(stoneDie, 3), new Object[] {
  99. "# #", " # ", "# #", Character.valueOf('#'), Block.stone
  100. });
  101. ModLoader.addRecipe(new ItemStack(ironDie, 1), new Object[] {
  102. " ", "###", " ", Character.valueOf('#'), Item.ingotIron
  103. });
  104. ModLoader.addRecipe(new ItemStack(diamondDie, 1), new Object[] {
  105. "# #", " # ", "# #", Character.valueOf('#'), Item.diamond
  106. });
  107. ModLoader.addAchievementDesc(currency, "SMP Currency!", "Get Paid.");
  108. ModLoader.registerTileEntity(TileEntityCoiner.class, "Coiner");
  109. MinecraftForge.setGuiHandler(instance, new GuiHandlerCurrency());}
  110. // ModLoader.RegisterGUI(this, coinerGUI);
  111. }
  112. public void OnItemPickup(EntityPlayer entityplayer, ItemStack itemstack)
  113. {
  114. if(itemstack.itemID == dupondius.shiftedIndex || itemstack.itemID == denarius.shiftedIndex || itemstack.itemID == aureus.shiftedIndex)
  115. {
  116. entityplayer.addStat(currency, 1);
  117. }
  118. }
  119. public static ItemStack getOutPut(int i, int j)
  120. {
  121. if(i == stoneBlank.shiftedIndex && (j == woodDie.shiftedIndex || j == stoneDie.shiftedIndex || j == ironDie.shiftedIndex || j == diamondDie.shiftedIndex))
  122. {
  123. return new ItemStack(dupondius, 1);
  124. } else
  125. {
  126. return null;
  127. }
  128. }
  129. public String getVersion()
  130. {
  131. return versionNumber;
  132. }
  133. static
  134. {
  135. stoneBlankID = 10800;
  136. ironBlockID = 10810;
  137. goldBlankID = 10820;
  138. quincunxID = 10830;
  139. denariID = 10840;
  140. aureusID = 10850;
  141. woodDieID = 10860;
  142. stoneDieID = 10870;
  143. ironDieID = 10880;
  144. diamondDieID = 10890;
  145. stoneBlank = (new Item(stoneBlankID + 256)).setItemName("stoneBlank");
  146. ironBlank = (new Item(ironBlockID + 256)).setItemName("ironBlank");
  147. goldBlank = (new Item(goldBlankID + 256)).setItemName("goldBlank");
  148. dupondius = (new Item(quincunxID + 256)).setItemName("dupondius");
  149. denarius = (new Item(denariID + 256)).setItemName("denarius");
  150. aureus = (new Item(aureusID + 256)).setItemName("aureus");
  151. woodDie = (new Item(woodDieID + 256)).setItemName("woodDie").setMaxStackSize(1).setMaxDamage(7);
  152. stoneDie = (new Item(stoneDieID + 256)).setItemName("stoneDie").setMaxStackSize(1).setMaxDamage(15);
  153. ironDie = (new Item(ironDieID + 256)).setItemName("ironDie").setMaxStackSize(1).setMaxDamage(31);
  154. diamondDie = (new Item(diamondDieID + 256)).setItemName("diamondDie").setMaxStackSize(1).setMaxDamage(127);
  155. currency = (new Achievement(3001, "currency", -3, 1, aureus, null)).registerAchievement();
  156. coiner = (new BlockCoiner(200, false)).setHardness(3F).setResistance(5F).setStepSound(Block.soundStoneFootstep).setBlockName("coiner");
  157. }
  158. public boolean clientSideRequired()
  159. {
  160. return true;
  161. }
  162. public boolean serverSideRequired()
  163. {
  164. return false;
  165. }}