oneofthem999

Main

Jun 11th, 2016
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. @Mod(modid = Main.MODID, version = Main.VERSION)
  2. public class Main
  3. {
  4. public static final String MODID = "potionsandpotionblocksmod";
  5. public static final String VERSION = "1.0";
  6. public static Block killBlock;
  7. public static Block neutralBlock;
  8. public static Potion auraPotion;
  9. public static Item auraPotionItem;
  10.  
  11. @EventHandler
  12. public void preInit(FMLPreInitializationEvent event)
  13. {
  14. //PreInit tasks
  15. Potion[] potionTypes = null;
  16.  
  17. //Creates a new array for potion types with room for new additions
  18. for (Field f : Potion.class.getDeclaredFields())
  19. {
  20. f.setAccessible(true);
  21. try {
  22. if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
  23. Field modfield = Field.class.getDeclaredField("modifiers");
  24. modfield.setAccessible(true);
  25. modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
  26.  
  27. potionTypes = (Potion[])f.get(null);
  28. final Potion[] newPotionTypes = new Potion[256];
  29. System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
  30. f.set(null, newPotionTypes);
  31. }
  32. }
  33. catch (Exception e)
  34. {
  35. System.err.println("Severe error, please report this to the mod author:");
  36. System.err.println(e);
  37. }
  38. }
  39.  
  40. MinecraftForge.EVENT_BUS.register(new AuraPotionEventHook());
  41. }
  42.  
  43. @EventHandler
  44. public void load(FMLInitializationEvent event)
  45. {
  46. //Load tasks
  47. killBlock = new KillBlock();
  48. neutralBlock = new NeutalizationBlock();
  49. auraPotion = (new AuraPotion(false, 0).setIconIndex(1, 1).setPotionName("potion.auraPotion"));
  50. auraPotionItem = new AuraPotionItemFood();
  51.  
  52. GameRegistry.registerBlock(killBlock, "killBlock");
  53. GameRegistry.registerBlock(neutralBlock, "neutralBlock");
  54. GameRegistry.registerItem(auraPotionItem, "auraPotionItem");
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment