Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Mod(modid = Main.MODID, version = Main.VERSION)
- public class Main
- {
- public static final String MODID = "potionsandpotionblocksmod";
- public static final String VERSION = "1.0";
- public static Block killBlock;
- public static Block neutralBlock;
- public static Potion auraPotion;
- public static Item auraPotionItem;
- @EventHandler
- public void preInit(FMLPreInitializationEvent event)
- {
- //PreInit tasks
- Potion[] potionTypes = null;
- //Creates a new array for potion types with room for new additions
- for (Field f : Potion.class.getDeclaredFields())
- {
- f.setAccessible(true);
- try {
- if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
- Field modfield = Field.class.getDeclaredField("modifiers");
- modfield.setAccessible(true);
- modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
- potionTypes = (Potion[])f.get(null);
- final Potion[] newPotionTypes = new Potion[256];
- System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
- f.set(null, newPotionTypes);
- }
- }
- catch (Exception e)
- {
- System.err.println("Severe error, please report this to the mod author:");
- System.err.println(e);
- }
- }
- MinecraftForge.EVENT_BUS.register(new AuraPotionEventHook());
- }
- @EventHandler
- public void load(FMLInitializationEvent event)
- {
- //Load tasks
- killBlock = new KillBlock();
- neutralBlock = new NeutalizationBlock();
- auraPotion = (new AuraPotion(false, 0).setIconIndex(1, 1).setPotionName("potion.auraPotion"));
- auraPotionItem = new AuraPotionItemFood();
- GameRegistry.registerBlock(killBlock, "killBlock");
- GameRegistry.registerBlock(neutralBlock, "neutralBlock");
- GameRegistry.registerItem(auraPotionItem, "auraPotionItem");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment