Advertisement
Guest User

Untitled

a guest
Dec 31st, 2012
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.46 KB | None | 0 0
  1. package Vanityblocks;
  2.  
  3. import net.minecraft.block.Block;
  4. import net.minecraft.item.Item;
  5. import net.minecraft.item.ItemStack;
  6. import net.minecraftforge.common.Configuration;
  7. import net.minecraftforge.oredict.OreDictionary;
  8. import net.minecraftforge.oredict.ShapedOreRecipe;
  9. import cpw.mods.fml.common.Mod;
  10. import cpw.mods.fml.common.Mod.Init;
  11. import cpw.mods.fml.common.Mod.Instance;
  12. import cpw.mods.fml.common.Mod.PostInit;
  13. import cpw.mods.fml.common.Mod.PreInit;
  14. import cpw.mods.fml.common.SidedProxy;
  15. import cpw.mods.fml.common.event.FMLInitializationEvent;
  16. import cpw.mods.fml.common.event.FMLPostInitializationEvent;
  17. import cpw.mods.fml.common.event.FMLPreInitializationEvent;
  18. import cpw.mods.fml.common.network.NetworkMod;
  19. import cpw.mods.fml.common.registry.GameRegistry;
  20. import cpw.mods.fml.common.registry.LanguageRegistry;
  21.  
  22. @Mod(modid="Vanityblocks", name="Anarchys Vanity Blocks", version= "0.0.1")
  23. @NetworkMod(clientSideRequired=true, serverSideRequired=false)
  24.  
  25. /*
  26. TO DO
  27. add steel stuff
  28. */
  29.  
  30.  
  31. public class Vanityblocks {
  32.  
  33. @Instance("Vanityblocks")
  34. public static Vanityblocks instance;
  35.  
  36. @SidedProxy(clientSide = "Vanityblocks.ProxyClient", serverSide = "Vanityblocks.Proxy")
  37. public static Proxy proxy;
  38. public static int lavalampconfig;
  39. public static int redstoneblockconfig;
  40. public static int coalblockconfig;
  41. public static int charcoalblockconfig;
  42. public static int enderpearlblockconfig;
  43. public static int tinblockconfig;
  44. public static int copperblockconfig;
  45. public static int silverblockconfig;
  46. public static int leadblockconfig;
  47. public static int nikoliteblockconfig;
  48. public static int slimeblockconfig;
  49.  
  50. public static Block lavalamp;
  51. public static Block redstoneblock;
  52. public static Block coalblock;
  53. public static Block charcoalblock;
  54. public static Block enderpearlblock;
  55. public static Block tinblock;
  56. public static Block copperblock;
  57. public static Block silverblock;
  58. public static Block leadblock;
  59. public static Block nikoliteblock;
  60. public static Block slimeblock;
  61. public static boolean Configflags;
  62.  
  63.  
  64. // public static Logger log = Logger.getLogger("Vanityblocks");
  65.  
  66. @PreInit
  67. public void preInit(FMLPreInitializationEvent event) {
  68. // nothing required here
  69. Configuration config = new Configuration(event.getSuggestedConfigurationFile());
  70.  
  71. config.load();
  72.  
  73. lavalampconfig = config.getBlock("LavaLamp", 3000).getInt();
  74. redstoneblockconfig = config.getBlock("Redstone Block", 3001).getInt();
  75. coalblockconfig = config.getBlock("Coal Block", 3002).getInt();
  76. charcoalblockconfig = config.getBlock("Charcoal Block",3003).getInt();
  77. enderpearlblockconfig = config.getBlock("Ender Pearl Block",3004).getInt();
  78. tinblockconfig = config.getBlock("Tin Block",3005).getInt();
  79. copperblockconfig = config.getBlock("Copper Block",3006).getInt();
  80. silverblockconfig = config.getBlock("Silver Block",3007).getInt();
  81. leadblockconfig = config.getBlock("Lead Block",3008).getInt();
  82. nikoliteblockconfig = config.getBlock("Nikolite Block",3009).getInt();
  83. slimeblockconfig = config.getBlock("Slime Block",3010).getInt();
  84. // int randomItemID = config.getItem("Redstone Block", 20000).getInt();
  85.  
  86. // Since this flag is a boolean, we can read it into the variable directly from the config.
  87. Configflags = config.get(Configuration.CATEGORY_GENERAL, "SomeConfigFlag", false).getBoolean(false);
  88.  
  89. config.save();
  90. }
  91.  
  92. @Init
  93. public void load(FMLInitializationEvent event) {
  94. // proxy.registerRenderInformation();
  95.  
  96. if (OreDictionary.getOres("lavalamp").isEmpty())
  97. {
  98. lavalamp = new Blocklavalamp(lavalampconfig,0).setBlockName("lavalamp");
  99. GameRegistry.registerBlock(lavalamp, "Vanitysanarchy_lavalamp");
  100. LanguageRegistry.addName(lavalamp, "Lava Lamp");
  101. }
  102. else lavalamp = OreDictionary.getOres("lavalamp").get(0);
  103.  
  104. if (OreDictionary.getOres("blockRedstone").isEmpty())
  105. {
  106. redstoneblock = new Blockredstone(redstoneblockconfig,1).setBlockName("blockRedstone");
  107. GameRegistry.registerBlock(redstoneblock, "Vanitysanarchy_blockRedstone");
  108. LanguageRegistry.addName(redstoneblock, "Redstone Block");
  109. }
  110. else redstoneblock = OreDictionary.getOres("blockRedstone").get(0);
  111.  
  112. if (OreDictionary.getOres("blockCoal").isEmpty())
  113. {
  114. coalblock = new Blockcoal(coalblockconfig,2).setBlockName("blockCoal");
  115. GameRegistry.registerBlock(coalblock, "blockCoal");
  116. LanguageRegistry.addName(coalblock, "Coal Block");
  117. }
  118. else coalblock = OreDictionary.getOres("blockCoal").get(0);
  119.  
  120. if (OreDictionary.getOres("blockCharcoal").isEmpty())
  121. {
  122. charcoalblock = new Blockcharcoal(charcoalblockconfig,3).setBlockName("blockCharcoal");
  123. GameRegistry.registerBlock(charcoalblock, "blockCharcoal");
  124. LanguageRegistry.addName(charcoalblock, "Charcoal Block");
  125. }
  126. else charcoalblock = OreDictionary.getOres("blockCharcoal").get(0);
  127.  
  128. if (OreDictionary.getOres("blockEnderpearl").isEmpty())
  129. {
  130. enderpearlblock = new Blockenderpearl(enderpearlblockconfig,4).setBlockName("blockEnderpearl");
  131. GameRegistry.registerBlock(enderpearlblock, "blockEnderpearl");
  132. LanguageRegistry.addName(enderpearlblock, "Enderpearl Block");
  133. }
  134. else enderpearlblock = OreDictionary.getOres("blockEnderpearl").get(0);
  135.  
  136. if (OreDictionary.getOres("blockTin").isEmpty())
  137. {
  138. tinblock = new Blocktin(tinblockconfig,5).setBlockName("blockTin");
  139. GameRegistry.registerBlock(tinblock, "blockTin");
  140. LanguageRegistry.addName(tinblock, "Tin Block");
  141. }
  142. else tinblock = OreDictionary.getOres("blockTin").get(0);
  143.  
  144. if (OreDictionary.getOres("blockCopper").isEmpty())
  145. {
  146. copperblock = new Blockcopper(copperblockconfig,6).setBlockName("blockCopper");
  147. GameRegistry.registerBlock(copperblock, "blockCopper");
  148. LanguageRegistry.addName(copperblock, "Copper Block");
  149. }
  150. else copperblock = OreDictionary.getOres("blockCopper").get(0);
  151.  
  152. if (OreDictionary.getOres("blockSilver").isEmpty())
  153. {
  154. silverblock = new Blocksilver(silverblockconfig,7).setBlockName("blockSilver");
  155. GameRegistry.registerBlock(silverblock, "blockSilver");
  156. LanguageRegistry.addName(silverblock, "Silver Block");
  157. }
  158. else silverblock = OreDictionary.getOres("blockSilver").get(0);
  159.  
  160. if (OreDictionary.getOres("blockLead").isEmpty())
  161. {
  162. leadblock = new Blocklead(leadblockconfig,8).setBlockName("blockLead");
  163. GameRegistry.registerBlock(leadblock, "blockLead");
  164. LanguageRegistry.addName(leadblock, "Lead Block");
  165. }
  166. else leadblock = OreDictionary.getOres("blockLead").get(0);
  167.  
  168. if (OreDictionary.getOres("blockNikolite").isEmpty())
  169. {
  170. nikoliteblock = new Blocknikolite(nikoliteblockconfig,9).setBlockName("blocknikolite");
  171. GameRegistry.registerBlock(nikoliteblock, "blockNikolite");
  172. LanguageRegistry.addName(nikoliteblock, "Nikolite Block");
  173. }
  174. else nikoliteblock = OreDictionary.getOres("blockNikolite").get(0);
  175.  
  176. if (OreDictionary.getOres("blockSlime").isEmpty())
  177. {
  178. slimeblock = new Blockslime(slimeblockconfig,10).setBlockName("blockSlime");
  179. GameRegistry.registerBlock(slimeblock, "blockSlime");
  180. LanguageRegistry.addName(slimeblock, "Slime Block");
  181. }
  182. else slimeblock = OreDictionary.getOres("blockSlime").get(0);
  183.  
  184. ItemStack glassstack = new ItemStack(Block.glass);
  185. ItemStack lavabukkit = new ItemStack(Item.bucketLava);
  186. ItemStack string = new ItemStack(Item.silk);
  187. ItemStack redstone = new ItemStack(Item.redstone);
  188. ItemStack coal = new ItemStack(Item.coal);
  189. ItemStack charcoal = new ItemStack(Item.coal,1,1);
  190. ItemStack enderpearl = new ItemStack(Item.enderPearl);
  191. ItemStack slime = new ItemStack(Item.slimeBall);
  192. ItemStack skeleskull = new ItemStack(Item.skull);
  193. ItemStack zombieskull = new ItemStack(Item.skull,1,2);
  194. ItemStack stevehead = new ItemStack(Item.skull,1,3);
  195. ItemStack creeperhead = new ItemStack(Item.skull,1,4);
  196.  
  197. ItemStack tiningot, copperingot, silveringot, leadingot, nikolite;
  198.  
  199. if (!OreDictionary.getOres("ingotTin").isEmpty())
  200. tiningot = OreDictionary.getOres("ingotTin").get(0);
  201. if (!OreDictionary.getOres("ingotCopper").isEmpty())
  202. copperingot = OreDictionary.getOres("ingotCopper").get(0);
  203. if (!OreDictionary.getOres("ingotSilver").isEmpty())
  204. silveringot = OreDictionary.getOres("ingotSilver").get(0);
  205. if (!OreDictionary.getOres("ingotLead").isEmpty())
  206. leadingot = OreDictionary.getOres("ingotLead").get(0);
  207. if (!OreDictionary.getOres("dustNikolite").isEmpty())
  208. nikolite = OreDictionary.getOres("dustNikolite").get(0);
  209. // Copy the above for:
  210. // Copper
  211. // Silver
  212. // Lead
  213. // dustNikolite
  214.  
  215. GameRegistry.addRecipe(new ItemStack(lavalamp), new Object [] {" x ", "xyx", " x ", 'x', glassstack, 'y', lavabukkit});
  216. // **** Put this in a different forgemod. Use the mcmod.info to declare two separate mods. ***
  217. //GameRegistry.addRecipe(new ItemStack(Block.web), new Object [] {"x x", " x ", "x x", 'x', string});
  218. //GameRegistry.addRecipe(skeleskull, new Object [] {"xxx", "xxx", "xxx", 'x', Item.bone});
  219. GameRegistry.addRecipe(new ItemStack(redstoneblock), new Object [] {"xxx", "xxx", "xxx", 'x', redstone});
  220.  
  221.  
  222. /*
  223. Storage Block Crafting
  224. */
  225. GameRegistry.addRecipe(new ItemStack(redstoneblock), new Object [] {"xxx", "xxx", "xxx", 'x', redstone});
  226. GameRegistry.addRecipe(new ItemStack(coalblock), new Object [] {"xxx", "xxx", "xxx", 'x', coal});
  227. GameRegistry.addRecipe(new ItemStack(charcoalblock), new Object [] {"xxx", "xxx", "xxx", 'x', charcoal});
  228. GameRegistry.addRecipe(new ItemStack(enderpearlblock), new Object [] {"xxx", "xxx", "xxx", 'x', enderpearl});
  229. GameRegistry.addRecipe(new ShapedOreRecipe(tinblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotTin"}));
  230. GameRegistry.addRecipe(new ShapedOreRecipe(copperblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotCopper"}));
  231. GameRegistry.addRecipe(new ShapedOreRecipe(silverblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotSilver"}));
  232. GameRegistry.addRecipe(new ShapedOreRecipe(leadblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotLead"}));
  233. GameRegistry.addRecipe(new ShapedOreRecipe(nikoliteblock, new Object [] {"xxx", "xxx", "xxx", 'x', "dustNikolite"}));
  234. GameRegistry.addRecipe(new ItemStack(slimeblock), new Object [] {"xxx", "xxx", "xxx", 'x', slime});
  235.  
  236. /*
  237. Storage Block Uncrafting
  238. */
  239. GameRegistry.addShapelessRecipe(new ItemStack(Item.redstone, 9), new ItemStack(redstoneblock,1));
  240. GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 9), new ItemStack(coalblock,1));
  241. GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 9,1), new ItemStack(charcoalblock,1));
  242. GameRegistry.addShapelessRecipe(new ItemStack(Item.enderPearl, 9), new ItemStack(enderpearlblock,1));
  243. GameRegistry.addShapelessRecipe(new ItemStack(tiningot, 9), new ItemStack(tinblock, 1));
  244. GameRegistry.addShapelessRecipe(new ItemStack(copperingot, 9), new ItemStack(copperblock, 1));
  245. GameRegistry.addShapelessRecipe(new ItemStack(silveringot, 9), new ItemStack(silverblock, 1));
  246. GameRegistry.addShapelessRecipe(new ItemStack(leadingot, 9), new ItemStack(leadblock, 1));
  247. GameRegistry.addShapelessRecipe(new ItemStack(nikolite, 9), new ItemStack(nikoliteblock, 1));
  248. GameRegistry.addShapelessRecipe(new ItemStack(slime, 9), new ItemStack(slimeblock,1));
  249. }
  250.  
  251. @PostInit
  252. public void postInit(FMLPostInitializationEvent event) {
  253. // If you want, you can move everything down here.
  254. // Alternately, you can declare in the mcmod.info that you
  255. // must be loaded after IC2, Redpower, Buildcraft, etc, etc, etc.
  256. // Either way will work.
  257. }
  258. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement