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.

Zock629

Members
  • Joined

  • Last visited

  1. I worked it out I forgot to put "implements IHasModel" into FoodBase
  2. I updated to add more of the code I have let me know if I need to show more
  3. Food item isn't rendering for me and I can't figure out why. FoodBase package com.zock629.firstmod.items; import com.zock629.firstmod.Main; import com.zock629.firstmod.init.ModItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemFood; public class FoodBase extends ItemFood { public FoodBase(String name, int amount, float saturation, boolean isWolfFood) { super(amount, saturation, isWolfFood); setUnlocalizedName(name); setRegistryName(name); setCreativeTab(CreativeTabs.FOOD); ModItems.ITEMS.add(this); } public void registerModels() { Main.proxy.registerItemRenderer(this, 0, "inventory"); } } DrinkBase package com.zock629.firstmod.items; import com.zock629.firstmod.Main; import com.zock629.firstmod.init.ModItems; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.Item; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; import net.minecraft.world.World; public class DrinkBase extends FoodBase { public DrinkBase(String name, int amount, float saturation, boolean isWolfFood) { super(name, amount, saturation, isWolfFood); // TODO Auto-generated constructor stub } public void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { player.inventory.addItemStackToInventory(new ItemStack(Item.getItemById(374))); } @Override public EnumAction getItemUseAction(ItemStack stack) { return EnumAction.DRINK; } } ModItems package com.zock629.firstmod.init; import java.util.ArrayList; import java.util.List; import com.zock629.firstmod.items.DrinkBase; import com.zock629.firstmod.items.FoodBase; import com.zock629.firstmod.items.ItemBase; import net.minecraft.item.Item; public class ModItems { public static final List<Item> ITEMS = new ArrayList<Item>(); public static final Item Ginger = new ItemBase("ginger"); public static final Item Ginger_Beer = new DrinkBase("ginger_beer", 1, 0.5F, false); } Json File { "parent": "item/generated", "textures": { "layer0": "fm:items/ginger_beer" } } EDIT: ClientProxy package com.zock629.firstmod.proxy; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; public class ClientProxy extends CommonProxy { public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(item.getRegistryName(), id)); } } CommonProxy package com.zock629.firstmod.proxy; import net.minecraft.item.Item; public class CommonProxy { public void registerItemRenderer(Item item, int meta, String id) {} } IHasModel package com.zock629.firstmod.util; public interface IHasModel { public void registerModels(); }

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.