brandon3055 Posted May 8, 2014 Posted May 8, 2014 ^That last one was a trick question I just updated from forge build 1061 to 1071 and now when i launch the game i get the following warning for most of my blocks and items. [12:00:05] [Client thread/WARN] [FML]: **************************************** [12:00:05] [Client thread/WARN] [FML]: * Illegal extra prefix tolkienaddon for name tolkienaddon:sunFocus, invalid registry invocation/invalid name? [12:00:05] [Client thread/WARN] [FML]: * at cpw.mods.fml.common.registry.GameData.registerItem(GameData.java:733) [12:00:05] [Client thread/WARN] [FML]: * at cpw.mods.fml.common.registry.GameRegistry.registerItem(GameRegistry.java:139) [12:00:05] [Client thread/WARN] [FML]: * at cpw.mods.fml.common.registry.GameRegistry.registerItem(GameRegistry.java:127) [12:00:05] [Client thread/WARN] [FML]: * at tolkienaddon.items.ModItems.register(ModItems.java:86) [12:00:05] [Client thread/WARN] [FML]: * at tolkienaddon.items.SunFocus.<init>(SunFocus.java:10) [12:00:05] [Client thread/WARN] [FML]: * at tolkienaddon.items.ModItems.init(ModItems.java:61)... [12:00:05] [Client thread/WARN] [FML]: **************************************** This is the item that the above warning is referring to: import tolkienaddon.Tolkienaddon; import tolkienaddon.lib.Strings; public class SunFocus extends TolkienItem { public SunFocus() { this.setUnlocalizedName(Strings.sunFocusName); this.setCreativeTab(Tolkienaddon.getCreativeTab()); ModItems.register(this); } } My Mod Item class: import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import tolkienaddon.lib.References; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class TolkienItem extends Item { public String getUnwrappedUnlocalizedName(final String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } @Override public String getUnlocalizedName() { return String.format("item.%s%s", References.RESOURCESPREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override public String getUnlocalizedName(final ItemStack itemStack) { return String.format("item.%s%s", References.RESOURCESPREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon(References.RESOURCESPREFIX + getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } } My mod Items class import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.util.EnumHelper; import tolkienaddon.items.armor.WyvernChestPlate; import tolkienaddon.items.tools.DraconicDistructionStaff; import tolkienaddon.items.tools.DraconicPickaxe; import tolkienaddon.items.tools.DraconicShovel; import tolkienaddon.items.tools.TeleporterItem; import tolkienaddon.items.tools.WyvernPickaxe; import tolkienaddon.items.tools.WyvernShovel; import tolkienaddon.items.weapons.DraconicBow; import tolkienaddon.items.weapons.DraconicSword; import tolkienaddon.items.weapons.WyvernBow; import tolkienaddon.items.weapons.WyvernSword; import cpw.mods.fml.common.registry.GameRegistry; public class ModItems { public static ArmorMaterial DRACONIUMARMOR_T1 = EnumHelper.addArmorMaterial("DRACONIUMARMOR_T1", -1, new int[] { 3, 8, 6, 3 }, 30); public static ToolMaterial DRACONIUM_T1 = EnumHelper.addToolMaterial("DRACONIUM_T1", 4, -1, 12.0F, 11.0F, 35); public static ToolMaterial DRACONIUM_T2 = EnumHelper.addToolMaterial("DRACONIUM_T2", 4, -1, 16.0F, 15.0F, 40); public static ToolMaterial DRACONIUM_T3 = EnumHelper.addToolMaterial("DRACONIUM_T3", 4, -1, 400.0F, 20.0F, 45); public static Item tclogo; public static Item temporalCore; public static Item sunFocus; public static Item draconicPickaxe; public static Item draconicShovel; public static Item draconicSword; public static Item draconicBow; public static Item wyvernPickaxe; public static Item wyvernShovel; public static Item wyvernSword; public static Item wyvernBow; public static Item wyvernChestPlate; public static Item infusedCompound; public static Item rawDraconicPickHead; public static Item rawDraconicSwordBlade; public static Item draconicPickHead; public static Item draconicSwordBlade; public static Item draconiumDust; public static Item draconiumIngot; public static Item draconiumBlend; public static Item dragonHeart; public static Item draconicDistructionStaff; public static Item draconicCompound; public static Item teleporterItem; public static Item testPick; public static void init() { tclogo = new Tclogo(); temporalCore = new TemporalCore(); sunFocus = new SunFocus(); draconicPickaxe = new DraconicPickaxe(); draconicShovel = new DraconicShovel(); draconicSword = new DraconicSword(); draconicBow = new DraconicBow(); wyvernPickaxe = new WyvernPickaxe(); wyvernShovel = new WyvernShovel(); wyvernSword = new WyvernSword(); wyvernBow = new WyvernChestPlate(); wyvernChestPlate = new WyvernBow(); infusedCompound = new InfusedCompound(); draconiumDust = new DraconiumDust(); draconiumIngot = new DraconiumIngot(); draconiumBlend = new DraconiumBlend(); dragonHeart = new DragonHeart(); draconicDistructionStaff = new DraconicDistructionStaff(); draconicCompound = new DraconicCompound(); teleporterItem = new TeleporterItem(); //testPick = new TestPick(); } public static void register(final TolkienItem item) { GameRegistry.registerItem(item, item.getUnwrappedUnlocalizedName(item.getUnlocalizedName())); } } My Common proxy (where Mod Items is initialized) import net.minecraftforge.common.MinecraftForge; import tolkienaddon.Tolkienaddon; import tolkienaddon.blocks.ModBlocks; import tolkienaddon.client.interfaces.GuiHandler; import tolkienaddon.core.handler.CraftingHandler; import tolkienaddon.core.handler.FMLEventHandler; import tolkienaddon.core.handler.ModEventHandler; import tolkienaddon.core.handler.packethandling.ServerPacketHandler; import tolkienaddon.items.ModItems; import tolkienaddon.tileentities.TileSunDial; import tolkienaddon.tileentities.TileWeatherController; import tolkienaddon.world.TolkienWorldGenerator; import cpw.mods.fml.common.FMLCommonHandler; 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.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; public class CommonProxy { private final static boolean debug = Tolkienaddon.debug; public void preInit(FMLPreInitializationEvent event) { ModBlocks.init(); ModItems.init(); GameRegistry.registerWorldGenerator(new TolkienWorldGenerator(), 1); registerTileEntities(); } public void init(FMLInitializationEvent event) { CraftingHandler.init(); registerEventListeners(); registerNetworkingChannel(); registerGuiHandeler(); registerWorldGen(); registerServerPacketHandler(); } public void postInit(FMLPostInitializationEvent event) { } public void registerTileEntities() { GameRegistry.registerTileEntity(TileWeatherController.class, "TileWeatherController"); GameRegistry.registerTileEntity(TileSunDial.class, "TileSunDial"); } public void registerEventListeners() { MinecraftForge.EVENT_BUS.register(new ModEventHandler()); FMLCommonHandler.instance().bus().register(new FMLEventHandler()); } public void registerNetworkingChannel() { Tolkienaddon.channel = NetworkRegistry.INSTANCE.newEventDrivenChannel(Tolkienaddon.networkChannelName); } public void registerServerPacketHandler() { if(debug) System.out.println("[DEBUG]CommonProxy: registerServerPacketHandler"); Tolkienaddon.channel.register(new ServerPacketHandler()); } public void registerGuiHandeler() { new GuiHandler(); } public void registerWorldGen() { GameRegistry.registerWorldGenerator(new TolkienWorldGenerator(), 1); } } and my main mod class: import java.util.Arrays; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import tolkienaddon.core.handler.packethandling.ServerPacketHandler; import tolkienaddon.core.proxy.CommonProxy; import tolkienaddon.creativetab.TolkienTab; import tolkienaddon.lib.References; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; 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.network.FMLEventChannel; import cpw.mods.fml.common.network.NetworkRegistry; @Mod(modid = References.MODID, name = References.MODNAME, version = References.VERSION) public class Tolkienaddon { @Instance public static Tolkienaddon instance; @SidedProxy(clientSide = References.CLIENTPROXYLOCATION, serverSide = References.COMMONPROXYLOCATION) public static CommonProxy proxy; private static CreativeTabs tolkienTab = new TolkienTab(CreativeTabs.getNextID(), References.MODID); public static final String networkChannelName = "tolkienaddon"; public static FMLEventChannel channel; public static boolean debug = true; @Mod.EventHandler public static void preInit(final FMLPreInitializationEvent event) { System.out.println("preInit()" + event.getModMetadata().name); event.getModMetadata().autogenerated = false; event.getModMetadata().credits = "Many Online tutorials"; event.getModMetadata().description = "This is a mod made for the Tolkiencraft mod pack"; event.getModMetadata().authorList = Arrays.asList("brandon3055"); event.getModMetadata().logoFile = "TCLogo.png"; event.getModMetadata().url = "http://dragontalk.net/node/71"; event.getModMetadata().version = References.VERSION + "-MC1.7.2"; proxy.preInit(event); } @Mod.EventHandler public void init(final FMLInitializationEvent event) { System.out.println("init()"); proxy.init(event); } @Mod.EventHandler public void postInit(final FMLPostInitializationEvent event) { System.out.println("postInit()"); proxy.postInit(event); } public static CreativeTabs getCreativeTab() { return tolkienTab; } } It seems the only items that dont get this error are my tools e.g. import java.util.List; import java.util.Set; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; import org.lwjgl.input.Keyboard; import tolkienaddon.Tolkienaddon; import tolkienaddon.items.ModItems; import tolkienaddon.lib.References; import tolkienaddon.lib.Strings; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; public class DraconicDistructionStaff extends ItemTool { public IIcon itemIcon0; public IIcon itemIcon1; public IIcon itemIcon2; private static Set<Block> minableBlocks = Sets.newHashSet(); private static final Set<Block> field_150915_c = Sets.newHashSet(new Block[] { Blocks.cobblestone, Blocks.double_stone_slab, Blocks.stone_slab, Blocks.stone, Blocks.sandstone, Blocks.mossy_cobblestone, Blocks.iron_ore, Blocks.iron_block, Blocks.coal_ore, Blocks.gold_block, Blocks.gold_ore, Blocks.diamond_ore, Blocks.diamond_block, Blocks.ice, Blocks.netherrack, Blocks.lapis_ore, Blocks.lapis_block, Blocks.redstone_ore, Blocks.lit_redstone_ore, Blocks.rail, Blocks.detector_rail, Blocks.golden_rail, Blocks.activator_rail }); private static final Set<Block> field_150916_c = Sets.newHashSet(new Block[] { Blocks.grass, Blocks.dirt, Blocks.sand, Blocks.gravel, Blocks.snow_layer, Blocks.snow, Blocks.clay, Blocks.farmland, Blocks.soul_sand, Blocks.mycelium }); private static final Set<Block> field_150917_c = Sets.newHashSet(new Block[] { Blocks.planks, Blocks.bookshelf, Blocks.log, Blocks.log2, Blocks.chest, Blocks.pumpkin, Blocks.lit_pumpkin }); static { for (Block block : field_150915_c) { minableBlocks.add(block); } for (Block block : field_150916_c) { minableBlocks.add(block); } for (Block block : field_150917_c) { minableBlocks.add(block); } } public DraconicDistructionStaff() { super(0F, ModItems.DRACONIUM_T3, minableBlocks); this.setUnlocalizedName(Strings.draconicDStaffName); this.setCreativeTab(Tolkienaddon.getCreativeTab()); this.setHarvestLevel("pickaxe", 4); this.setHarvestLevel("spade", 4); this.setHarvestLevel("axe", 4); GameRegistry.registerItem(this, Strings.draconicDStaffName); } @Override public boolean func_150897_b(Block p_150897_1_) { return p_150897_1_ == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() == 3 : (p_150897_1_ != Blocks.diamond_block && p_150897_1_ != Blocks.diamond_ore ? (p_150897_1_ != Blocks.emerald_ore && p_150897_1_ != Blocks.emerald_block ? (p_150897_1_ != Blocks.gold_block && p_150897_1_ != Blocks.gold_ore ? (p_150897_1_ != Blocks.iron_block && p_150897_1_ != Blocks.iron_ore ? (p_150897_1_ != Blocks.lapis_block && p_150897_1_ != Blocks.lapis_ore ? (p_150897_1_ != Blocks.redstone_ore && p_150897_1_ != Blocks.lit_redstone_ore ? (p_150897_1_.getMaterial() == Material.rock ? true : (p_150897_1_.getMaterial() == Material.iron ? true : p_150897_1_.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial .getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2); } @Override public float func_150893_a(ItemStack p_150893_1_, Block p_150893_2_) { return p_150893_2_.getMaterial() != Material.iron && p_150893_2_.getMaterial() != Material.anvil && p_150893_2_.getMaterial() != Material.rock ? super.func_150893_a(p_150893_1_, p_150893_2_) : this.efficiencyOnProperMaterial; } @Override @SideOnly(Side.CLIENT) public void registerIcons(final IIconRegister iconRegister) { this.itemIcon0 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconicDStaff0"); this.itemIcon1 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconicDStaff1"); this.itemIcon2 = iconRegister.registerIcon(References.RESOURCESPREFIX + "draconicDStaff2"); } @Override @SideOnly(Side.CLIENT) public IIcon getIconFromDamage(int par1) { if (par1 == 0) return itemIcon0; else if (par1 == 1) return itemIcon1; else return itemIcon2; } @Override public boolean onBlockStartBreak(final ItemStack stack, final int x, final int y, final int z, final EntityPlayer player) { //ToolHandler.checkTag(stack); World world = player.worldObj; Block block = world.getBlock(x, y, z); Material mat = block.getMaterial(); if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsDStaff)) { return false; } int fortune = EnchantmentHelper.getFortuneModifier(player); boolean silk = EnchantmentHelper.getSilkTouchModifier(player); ToolHandler.disSquare(x, y, z, player, world, silk, fortune, ToolHandler.materialsDStaff, stack); return false; } @Override public ItemStack onItemRightClick(final ItemStack stack, final World world, final EntityPlayer player) { return ToolHandler.changeMode(stack, player, true, 4); } @Override public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) { ToolHandler.AOEAttack(player, entity, stack, 25, 6); ToolHandler.demageEntytyBasedOnHealth(entity, player, 0.5F); return true; } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public Multimap getItemAttributeModifiers() { Multimap multimap = super.getItemAttributeModifiers(); multimap.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(field_111210_e, "Weapon modifier", (double) 4.0F + ModItems.DRACONIUM_T2.getDamageVsEntity(), 0)); return multimap; } @SuppressWarnings({ "rawtypes", "unchecked" }) @Override public void addInformation(final ItemStack stack, final EntityPlayer player, final List list, final boolean extraInformation) { ToolHandler.checkTag(stack); int size = ((stack.getTagCompound().getShort("size")) * 2) + 1; boolean oblit = stack.getTagCompound().getBoolean("obliterate"); if ((!Keyboard.isKeyDown(42)) && (!Keyboard.isKeyDown(54))) list.add(EnumChatFormatting.DARK_GREEN + "Hold shift for information"); else { list.add(EnumChatFormatting.GREEN + "Mining Mode: " + EnumChatFormatting.BLUE + size + "x" + size); list.add(EnumChatFormatting.GREEN + "Shift Right-click to change minning mode"); list.add(StatCollector.translateToLocal("msg.oblit" + oblit + ".txt")); list.add(EnumChatFormatting.GREEN + "Right-click to toggle Obliteration mode"); list.add(EnumChatFormatting.GREEN + "Obliteration mode destroys low value blocks"); list.add(""); list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "After great pains you have managed"); list.add(EnumChatFormatting.DARK_PURPLE + "" + EnumChatFormatting.ITALIC + "to master the Draconic powers!"); } } @Override public EnumRarity getRarity(ItemStack stack) { return EnumRarity.epic; } public static void registerRecipe() { CraftingManager.getInstance().addRecipe(new ItemStack(ModItems.draconicDistructionStaff), "DTD", "PFS", "DWD", 'F', ModItems.sunFocus, 'D', ModItems.draconicCompound, 'T', ModItems.temporalCore, 'P', ModItems.draconicPickaxe, 'S', ModItems.draconicShovel, 'W', ModItems.draconicSword); } } Quote I am the author of Draconic Evolution
jabelar Posted May 8, 2014 Posted May 8, 2014 Interesting. Just because I'm a sucker for punishment I'm going to try to upgrade to 1071 as well. I'll tell you how it goes in a second. Note though that my current projects are mostly related to entities and so don't have blocks or tools. But do have items. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
jabelar Posted May 8, 2014 Posted May 8, 2014 Okay I upgraded to 1071 and didn't see any such error. The one thing I noticed though (read it quickly maybe I mis-read) is that you're calling the register() method from inside your constructor. I'm not sure if that would be an issue, but I do it differently. I just directly register the item after creating it: Item itemSpawnEgg = new ItemWildAnimalSpawnEgg(parSpawnName, parEggColor, parEggSpotsColor).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName("wildanimals:spawn_egg"); GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); I don't know if that is related to your problem, but since 1071 is working for me and you're getting warnings about the game registry I though I would point it out. Quote Check out my tutorials here: http://jabelarminecraft.blogspot.com/
brandon3055 Posted May 8, 2014 Author Posted May 8, 2014 Hmm i will have to add it to the list of things to figure out. My current setup is based on a couple o tutorials and it hasnt been a problem untill now Quote I am the author of Draconic Evolution
SanAndreaP Posted May 8, 2014 Posted May 8, 2014 Hmm i will have to add it to the list of things to figure out. My current setup is based on a couple o tutorials and it hasnt been a problem untill now I don't reccomend using the unlocalized name for the GameRegistry.registerItem/Block methods. Your problem seems to be that it has a prefix ("prefix:name") and judging from your code, you add the References.RESOURCESPREFIX in the getUnlocalizedName methods. Quote Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! | mah twitter This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.
brandon3055 Posted May 8, 2014 Author Posted May 8, 2014 you add the References.RESOURCESPREFIX in the getUnlocalizedName methods. Yup that was the problem. I probably should have been able to figure that out without making a post but i didn't really look into the problem to much because the problem didn't exist until i updated forge so i assumed it must be a forge bug. Oh well thanks for the help. Quote I am the author of Draconic Evolution
santisanxp Posted July 6, 2014 Posted July 6, 2014 you add the References.RESOURCESPREFIX in the getUnlocalizedName methods. Yup that was the problem. I probably should have been able to figure that out without making a post but i didn't really look into the problem to much because the problem didn't exist until i updated forge so i assumed it must be a forge bug. Oh well thanks for the help. Hello guys, I've been looking for this same error (But with battelegear2 mod) and so far you're the only ones that could fix it, unfortunately i have no idea what are you talking about LOL . Which are those files that I have to modify to get the issue solve? So far I don't see any errors in-game but I don't like to see that error everytime I start my server. Any help will be really aprreciatted Thanks in advance. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.