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.

TehSeph

Members
  • Joined

  • Last visited

Everything posted by TehSeph

  1. ItemModMeta, it's then overwritten inside the ItemOreDusts' constructor with the class' specific list.
  2. Can I first start off by saying jumping code from 1.5.2 straight to 1.7.2/1.7.10... not fun. Basically re-writing the entire thing. Anyway, after several hours of searching for a solution I've decided to make a post here. I have an item (a few items, actually) that is subtyped via metadata and using /give works and appears to be coded and localized correctly. However, when viewing the tab in the creative menu only the first subtype is shown and can be spawned. (Yes, the dust/ingot textures are from TherrmalExpansion. These are only temp. textures.) ItemMod.java package com.tehseph.sephsmod.item; import com.tehseph.sephsmod.core.Globals; import com.tehseph.sephsmod.core.ModCreativeTab; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; public class ItemMod extends Item { public ItemMod() { super(); this.setCreativeTab(ModCreativeTab.tabSephsMod); this.setMaxStackSize(1); this.setNoRepair(); } @Override public String getUnlocalizedName() { return String.format("item.%s:%s", Globals.MODID.toLowerCase(), getUnwrappedName()); } @Override public String getUnlocalizedName(ItemStack itemStack) { return String.format("item.%s:%s", Globals.MODID.toLowerCase(), getUnwrappedName()); } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1)); } protected String getUnwrappedName() { return super.getUnlocalizedName().substring(super.getUnlocalizedName().indexOf(".") + 1); } } ItemModMeta.java package com.tehseph.sephsmod.item; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; import java.util.List; public class ItemModMeta extends ItemMod { protected String[] metaNames; protected IIcon[] metaIcons; public ItemModMeta() { super(); this.setHasSubtypes(true); } @Override public String getUnlocalizedName(ItemStack itemStack) { return (super.getUnlocalizedName() + "_" + this.metaNames[itemStack.getItemDamage()]); } @SideOnly(Side.CLIENT) public String getUnlocalizedName(int metadata) { return (super.getUnlocalizedName() + "_" + this.metaNames[metadata]); } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int metadata) { return this.metaIcons[metadata]; } @Override @SideOnly(Side.CLIENT) public void registerIcons(IIconRegister iconRegister) { itemIcon = iconRegister.registerIcon(this.getUnlocalizedName(0).substring(this.getUnlocalizedName(0).indexOf(".") + 1)); for (int i = 0; i < metaIcons.length; i++) { metaIcons[i] = iconRegister.registerIcon(this.getUnlocalizedName(i).substring(this.getUnlocalizedName(i).indexOf(".") + 1)); } } @SideOnly(Side.CLIENT) public void getSubItems(int itemID, CreativeTabs cTab, List itemList) { for (int i = 0; i < this.metaNames.length; ++i) { itemList.add(new ItemStack(this, 1, i)); } } } ItemOreDusts.java package com.tehseph.sephsmod.item; import net.minecraft.util.IIcon; public class ItemOreDusts extends ItemModMeta { private String[] dustNames = {"Copper", "Gold", "Iron", "Tin" }; public ItemOreDusts() { super(); this.metaNames = this.dustNames; this.metaIcons = new IIcon[this.dustNames.length]; this.setUnlocalizedName("oreDusts"); } } ModItems.java package com.tehseph.sephsmod.core; import com.tehseph.sephsmod.item.*; import cpw.mods.fml.common.registry.GameRegistry; @GameRegistry.ObjectHolder(Globals.MODID) public class ModItems { public static final ItemMod grindstone = new ItemGrindstone(); public static final ItemMod infernalStone = new ItemInfernalStone(); public static final ItemMod oreDusts = new ItemOreDusts(); public static final ItemMod oreIngots = new ItemOreIngots(); public static void init() { GameRegistry.registerItem(grindstone, "grindstone"); GameRegistry.registerItem(infernalStone, "infernalStone"); GameRegistry.registerItem(oreDusts, "oreDusts"); GameRegistry.registerCustomItemStack("dustCopper", new ItemStack(oreDusts, 1, 0)); GameRegistry.registerCustomItemStack("dustGold", new ItemStack(oreDusts, 1, 1)); GameRegistry.registerCustomItemStack("dustIron", new ItemStack(oreDusts, 1, 2)); GameRegistry.registerCustomItemStack("dustTin", new ItemStack(oreDusts, 1, 3)); GameRegistry.registerItem(oreIngots, "oreIngots"); GameRegistry.registerCustomItemStack("ingotCopper", new ItemStack(oreIngots, 1, 0)); GameRegistry.registerCustomItemStack("ingotTin", new ItemStack(oreIngots, 1, 1)); } }
  3. http://www.minecraftforge.net/forum/index.php/topic,4415.0.html There is a topic PINNED not but 3 topics above this one... ~sigh~
  4. Glorious! Exactly what I wanted to know. =)
  5. Is there a method available in the API to force a mod to load last (after all other mods)? (Sorry for the short-winded post, but I'm not sure how to elaborate on this question...)

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.