Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

rushzone

Members
  • Joined

  • Last visited

Everything posted by rushzone

  1. Hi, so I am trying to give my custom food multiple potion effects like a golden apple. When I run my program it compiles but when I eat the food, I don't receive any pot effects. Here is my source code for the main mod class, and the custom food class: [Main Mod Class] package zone.rush.moretoolsmod; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.registry.GameRegistry; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; @Mod(modid = "mm", name = "More Tools Mod", version = "1.0") public class MoreToolsMod { public static Item itemEmeraldPickaxe; public static Item itemEmeraldSword; public static Item itemEmeraldAxe; public static Item itemEmeraldShovel; public static Block blockEmerald; public static Item EmeraldApple; @EventHandler public void preInit(FMLPreInitializationEvent event) { //Item/Block init and registering //config handleing EmeraldApple = new ItemFood(10, false).setUnlocalizedName("EmeraldApple").setCreativeTab(tabMoreToolsMod); GameRegistry.registerItem(EmeraldApple, EmeraldApple.getUnlocalizedName().substring(5)); itemEmeraldSword = new itemEmeraldSword().setUnlocalizedName("itemEmeraldSword").setTextureName("mm:Emerald_Sword"); GameRegistry.registerItem(itemEmeraldSword, itemEmeraldSword.getUnlocalizedName().substring(5)); itemEmeraldPickaxe = new itemEmeraldPickaxe().setUnlocalizedName("itemEmeraldPickaxe").setTextureName("mm:itemEmerald_Pickaxe").setCreativeTab(tabMoreToolsMod); GameRegistry.registerItem(itemEmeraldPickaxe, itemEmeraldPickaxe.getUnlocalizedName().substring(5)); blockEmerald = new blockEmerald(Material.iron).setBlockName("blockEmerald").setBlockTextureName("mm:emerald_block"); GameRegistry.registerBlock(blockEmerald, blockEmerald.getUnlocalizedName().substring(5)); System.out.println(blockEmerald.getUnlocalizedName().substring(5)); itemEmeraldAxe = new itemEmeraldAxe().setUnlocalizedName("itemEmeraldAxe").setTextureName("mm:Emerald_Axe"); GameRegistry.registerItem(itemEmeraldAxe, itemEmeraldAxe.getUnlocalizedName().substring(5)); itemEmeraldShovel = new itemEmeraldShovel().setUnlocalizedName("itemEmeraldShovel").setTextureName("mm:Emerald_Shovel"); GameRegistry.registerItem(itemEmeraldShovel, itemEmeraldShovel.getUnlocalizedName().substring(5)); } @EventHandler public void init(FMLInitializationEvent event) { //Proxy, TileEntity, GUI and Packet Registering GameRegistry.addRecipe(new ItemStack(itemEmeraldPickaxe), new Object[] {"EEE", " S ", " S ", 'E', Items.emerald, 'S', Items.stick}); } @EventHandler public void postInit(FMLPostInitializationEvent event) { //Get a list of the blocks from every mod. } public static CreativeTabs tabMoreToolsMod = new CreativeTabs("tabMoreToolsMod") { @Override public Item getTabIconItem() { return new ItemStack(itemEmeraldPickaxe).getItem(); } }; } [Food Extension Class] package zone.rush.moretoolsmod; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.world.World; public class EmeraldApple extends ItemFood { public EmeraldApple(int a, boolean b) { super(a,b); // TODO Auto-generated constructor stub } @Override public void onFoodEaten(ItemStack i, World w, EntityPlayer e){ // Add Potion Effects e.addPotionEffect(new PotionEffect(Potion.regeneration.id, 1000, 2)); e.addPotionEffect(new PotionEffect(Potion.resistance.id, 1000, 1)); e.addPotionEffect(new PotionEffect(Potion.fireResistance.id, 1000, 0)); } } Thanks a lot! BTW! If you're wondering why I am using Forge 1.7.10, the short answer is... I dislike the new versions of Minecraft

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.