@SuppressWarnings("unchecked") @Init public void load(FMLInitializationEvent event) { // Register the GUI Handler NetworkRegistry.instance().registerGuiHandler(instance, proxy); // Register the PlayerDestroyItem Handler MinecraftForge.EVENT_BUS.register(new PlayerDestroyItemHandler()); // Register the Item Pickup Handler MinecraftForge.EVENT_BUS.register(new ItemEventHandler()); // Register the EntityLiving Handler MinecraftForge.EVENT_BUS.register(new EntityLivingHandler()); MinecraftForge.EVENT_BUS.register(new ActionRequestHandler()); MinecraftForge.EVENT_BUS.register(new WorldTransmutationHandler()); GameRegistry.registerCraftingHandler(new CraftingHandler()); // Register the DrawBlockHighlight Handler proxy.registerDrawBlockHighlightHandler(); // Initialize mod tile entities proxy.registerTileEntities(); // Initialize custom rendering and pre-load textures (Client only) proxy.initRenderingAndTextures(); // Add in the ability to dye Alchemical Bags CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes()); // Register the Fuel Handler GameRegistry.registerFuelHandler(new FuelHandler()); // Quick test to see that sending an encoded recipe to be added to the recipe registry works FMLInterModComms.sendMessage( Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT( Item.bucketWater, Arrays.asList(Item.bucketEmpty, Block.waterStill))); FMLInterModComms.sendMessage( Reference.MOD_ID, InterModComms.ADD_RECIPE, NBTHelper.encodeRecipeAsNBT( Item.bucketLava, Arrays.asList(Item.bucketEmpty, Block.lavaStill))); }
@Override public void onContainerClosed(EntityPlayer player) { super.onContainerClosed(player); if (!player.worldObj.isRemote) { InventoryPlayer invPlayer = player.inventory; for (ItemStack itemStack : invPlayer.mainInventory) { if (itemStack != null) { if (NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN)) { NBTHelper.removeTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN); } } } } }