Advertisement
riking

Untitled

Dec 31st, 2012
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. lavalamp = new Blocklavalamp(lavalampconfig,0).setBlockName("lavalamp");
  97. GameRegistry.registerBlock(lavalamp, "Vanitysanarchy_lavalamp");
  98. LanguageRegistry.addName(lavalamp, "Lava Lamp");
  99.  
  100. ItemStack tiningot, copperingot, silveringot, leadingot, nikolite;
  101. ItemStack blRedstone, blCoal, blCharcoal, blEnderpearl, blTin, blCopper, blSilver, blLead, blNikolite, blSlime;
  102.  
  103. // Vanilla
  104.  
  105. if (OreDictionary.getOres("blockRedstone").isEmpty())
  106. {
  107. redstoneblock = new Blockredstone(redstoneblockconfig,1).setBlockName("blockRedstone");
  108. GameRegistry.registerBlock(redstoneblock, "Vanitysanarchy_blockRedstone");
  109. LanguageRegistry.addName(redstoneblock, "Redstone Block");
  110. blRedstone = new ItemStack(redstoneblock);
  111. }
  112. else blRedstone = OreDictionary.getOres("blockRedstone").get(0);
  113.  
  114. if (OreDictionary.getOres("blockCoal").isEmpty())
  115. {
  116. coalblock = new Blockcoal(coalblockconfig,2).setBlockName("blockCoal");
  117. GameRegistry.registerBlock(coalblock, "blockCoal");
  118. LanguageRegistry.addName(coalblock, "Coal Block");
  119. blCoal = new ItemStack(coalblock);
  120. }
  121. else blCoal = OreDictionary.getOres("blockCoal").get(0);
  122.  
  123. if (OreDictionary.getOres("blockCharcoal").isEmpty())
  124. {
  125. charcoalblock = new Blockcharcoal(charcoalblockconfig,3).setBlockName("blockCharcoal");
  126. GameRegistry.registerBlock(charcoalblock, "blockCharcoal");
  127. LanguageRegistry.addName(charcoalblock, "Charcoal Block");
  128. }
  129. else blCharcoal = OreDictionary.getOres("blockCharcoal").get(0);
  130.  
  131. if (OreDictionary.getOres("blockEnderpearl").isEmpty())
  132. {
  133. enderpearlblock = new Blockenderpearl(enderpearlblockconfig,4).setBlockName("blockEnderpearl");
  134. GameRegistry.registerBlock(enderpearlblock, "blockEnderpearl");
  135. LanguageRegistry.addName(enderpearlblock, "Enderpearl Block");
  136. }
  137. else blEnderpearl = OreDictionary.getOres("blockEnderpearl").get(0);
  138.  
  139. // Mod Items
  140.  
  141. if (!OreDictionary.getOres("ingotTin").isEmpty())
  142. {
  143. if (OreDictionary.getOres("blockTin").isEmpty())
  144. {
  145. tinblock = new Blocktin(tinblockconfig,5).setBlockName("blockTin");
  146. GameRegistry.registerBlock(tinblock, "blockTin");
  147. LanguageRegistry.addName(tinblock, "Tin Block");
  148. blTin = new ItemStack(tinblock);
  149. }
  150. else { blTin = OreDictionary.getOres("blockTin").get(0); }
  151.  
  152. GameRegistry.addRecipe(new ShapedOreRecipe(blTin, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotTin"}));
  153. tiningot = OreDictionary.getOres("ingotTin").get(0);
  154. ItemStack result = tiningot.copy();
  155. result.stackSize = 9;
  156. GameRegistry.addShapelessRecipe(result, blTin);
  157. }
  158.  
  159. if (OreDictionary.getOres("blockCopper").isEmpty())
  160. {
  161. copperblock = new Blockcopper(copperblockconfig,6).setBlockName("blockCopper");
  162. GameRegistry.registerBlock(copperblock, "blockCopper");
  163. LanguageRegistry.addName(copperblock, "Copper Block");
  164. }
  165. else copperblock = OreDictionary.getOres("blockCopper").get(0);
  166.  
  167. if (OreDictionary.getOres("blockSilver").isEmpty())
  168. {
  169. silverblock = new Blocksilver(silverblockconfig,7).setBlockName("blockSilver");
  170. GameRegistry.registerBlock(silverblock, "blockSilver");
  171. LanguageRegistry.addName(silverblock, "Silver Block");
  172. }
  173. else silverblock = OreDictionary.getOres("blockSilver").get(0);
  174.  
  175. if (OreDictionary.getOres("blockLead").isEmpty())
  176. {
  177. leadblock = new Blocklead(leadblockconfig,8).setBlockName("blockLead");
  178. GameRegistry.registerBlock(leadblock, "blockLead");
  179. LanguageRegistry.addName(leadblock, "Lead Block");
  180. }
  181. else leadblock = OreDictionary.getOres("blockLead").get(0);
  182.  
  183. if (OreDictionary.getOres("blockNikolite").isEmpty())
  184. {
  185. nikoliteblock = new Blocknikolite(nikoliteblockconfig,9).setBlockName("blocknikolite");
  186. GameRegistry.registerBlock(nikoliteblock, "blockNikolite");
  187. LanguageRegistry.addName(nikoliteblock, "Nikolite Block");
  188. }
  189. else nikoliteblock = OreDictionary.getOres("blockNikolite").get(0);
  190.  
  191. if (OreDictionary.getOres("blockSlime").isEmpty())
  192. {
  193. slimeblock = new Blockslime(slimeblockconfig,10).setBlockName("blockSlime");
  194. GameRegistry.registerBlock(slimeblock, "blockSlime");
  195. LanguageRegistry.addName(slimeblock, "Slime Block");
  196. }
  197. else slimeblock = OreDictionary.getOres("blockSlime").get(0);
  198.  
  199. ItemStack glassstack = new ItemStack(Block.glass);
  200. ItemStack lavabukkit = new ItemStack(Item.bucketLava);
  201. ItemStack string = new ItemStack(Item.silk);
  202. ItemStack redstone = new ItemStack(Item.redstone);
  203. ItemStack coal = new ItemStack(Item.coal);
  204. ItemStack charcoal = new ItemStack(Item.coal,1,1);
  205. ItemStack enderpearl = new ItemStack(Item.enderPearl);
  206. ItemStack slime = new ItemStack(Item.slimeBall);
  207. ItemStack skeleskull = new ItemStack(Item.skull);
  208. ItemStack zombieskull = new ItemStack(Item.skull,1,2);
  209. ItemStack stevehead = new ItemStack(Item.skull,1,3);
  210. ItemStack creeperhead = new ItemStack(Item.skull,1,4);
  211.  
  212.  
  213. if (!OreDictionary.getOres("ingotTin").isEmpty())
  214.  
  215. if (!OreDictionary.getOres("ingotCopper").isEmpty())
  216. copperingot = OreDictionary.getOres("ingotCopper").get(0);
  217. if (!OreDictionary.getOres("ingotSilver").isEmpty())
  218. silveringot = OreDictionary.getOres("ingotSilver").get(0);
  219. if (!OreDictionary.getOres("ingotLead").isEmpty())
  220. leadingot = OreDictionary.getOres("ingotLead").get(0);
  221. if (!OreDictionary.getOres("dustNikolite").isEmpty())
  222. nikolite = OreDictionary.getOres("dustNikolite").get(0);
  223. // Copy the above for:
  224. // Copper
  225. // Silver
  226. // Lead
  227. // dustNikolite
  228.  
  229. GameRegistry.addRecipe(new ItemStack(lavalamp), new Object [] {" x ", "xyx", " x ", 'x', glassstack, 'y', lavabukkit});
  230. // **** Put this in a different forgemod. Use the mcmod.info to declare two separate mods. ***
  231. //GameRegistry.addRecipe(new ItemStack(Block.web), new Object [] {"x x", " x ", "x x", 'x', string});
  232. //GameRegistry.addRecipe(skeleskull, new Object [] {"xxx", "xxx", "xxx", 'x', Item.bone});
  233. GameRegistry.addRecipe(new ItemStack(redstoneblock), new Object [] {"xxx", "xxx", "xxx", 'x', redstone});
  234.  
  235.  
  236. /*
  237. Storage Block Crafting
  238. */
  239. GameRegistry.addRecipe(new ItemStack(redstoneblock), new Object [] {"xxx", "xxx", "xxx", 'x', redstone});
  240. GameRegistry.addRecipe(new ItemStack(coalblock), new Object [] {"xxx", "xxx", "xxx", 'x', coal});
  241. GameRegistry.addRecipe(new ItemStack(charcoalblock), new Object [] {"xxx", "xxx", "xxx", 'x', charcoal});
  242. GameRegistry.addRecipe(new ItemStack(enderpearlblock), new Object [] {"xxx", "xxx", "xxx", 'x', enderpearl});
  243. GameRegistry.addRecipe(new ShapedOreRecipe(tinblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotTin"}));
  244. GameRegistry.addRecipe(new ShapedOreRecipe(copperblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotCopper"}));
  245. GameRegistry.addRecipe(new ShapedOreRecipe(silverblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotSilver"}));
  246. GameRegistry.addRecipe(new ShapedOreRecipe(leadblock, new Object [] {"xxx", "xxx", "xxx", 'x', "ingotLead"}));
  247. GameRegistry.addRecipe(new ShapedOreRecipe(nikoliteblock, new Object [] {"xxx", "xxx", "xxx", 'x', "dustNikolite"}));
  248. GameRegistry.addRecipe(new ItemStack(slimeblock), new Object [] {"xxx", "xxx", "xxx", 'x', slime});
  249.  
  250. /*
  251. Storage Block Uncrafting
  252. */
  253. GameRegistry.addShapelessRecipe(new ItemStack(Item.redstone, 9), new ItemStack(redstoneblock,1));
  254. GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 9), new ItemStack(coalblock,1));
  255. GameRegistry.addShapelessRecipe(new ItemStack(Item.coal, 9,1), new ItemStack(charcoalblock,1));
  256. GameRegistry.addShapelessRecipe(new ItemStack(Item.enderPearl, 9), new ItemStack(enderpearlblock,1));
  257. GameRegistry.addShapelessRecipe(new ItemStack(tiningot, 9), new ItemStack(tinblock, 1));
  258. GameRegistry.addShapelessRecipe(new ItemStack(copperingot, 9), new ItemStack(copperblock, 1));
  259. GameRegistry.addShapelessRecipe(new ItemStack(silveringot, 9), new ItemStack(silverblock, 1));
  260. GameRegistry.addShapelessRecipe(new ItemStack(leadingot, 9), new ItemStack(leadblock, 1));
  261. GameRegistry.addShapelessRecipe(new ItemStack(nikolite, 9), new ItemStack(nikoliteblock, 1));
  262. GameRegistry.addShapelessRecipe(new ItemStack(slime, 9), new ItemStack(slimeblock,1));
  263. }
  264.  
  265. @PostInit
  266. public void postInit(FMLPostInitializationEvent event) {
  267. // If you want, you can move everything down here.
  268. // Alternately, you can declare in the mcmod.info that you
  269. // must be loaded after IC2, Redpower, Buildcraft, etc, etc, etc.
  270. // Either way will work.
  271. }
  272. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement