Jump to content

[Bug Report] Overriding items


BlackEviL

Recommended Posts

my code :

public static void overrideItem(Item itemold, Item itemnew) {
    	try {
    		itemold.setCreativeTab(null);
    		String name = ((ResourceLocation)Item.REGISTRY.getNameForObject(itemold)).toString();
    		System.out.println("OVERRIDE: " + name);
    		itemnew.setUnlocalizedName(itemold.getUnlocalizedName().replaceFirst("item.", ""));
	GameRegistry.addSubstitutionAlias((name), GameRegistry.Type.ITEM, itemnew);

} catch (Exception e) {
		e.printStackTrace();
}
}

for example :

overrideItem(Items.IRON_HELMET, new ItemArmorMod(ItemArmor.ArmorMaterial.IRON, 2, EntityEquipmentSlot.HEAD));
overrideItem(Items.IRON_CHESTPLATE, new ItemArmorMod(ItemArmor.ArmorMaterial.IRON, 2, EntityEquipmentSlot.CHEST));
overrideItem(Items.IRON_LEGGINGS, new ItemArmorMod(ItemArmor.ArmorMaterial.IRON, 2, EntityEquipmentSlot.LEGS));
overrideItem(Items.IRON_BOOTS, new ItemArmorMod(ItemArmor.ArmorMaterial.IRON, 2, EntityEquipmentSlot.FEET));

error :

[23:35:58] [server thread/ERROR] [FML]: Fatal errors were detected during the transition from SERVER_ABOUT_TO_START to SERVER_STARTING. Loading cannot continue

[23:35:58] [server thread/ERROR] [FML]:

States: 'U' = Unloaded 'L' = Loaded 'C' = Constructed 'H' = Pre-initialized 'I' = Initialized 'J' = Post-initialized 'A' = Available 'D' = Disabled 'E' = Errored

UCHIJAAA mcp{9.19} [Minecraft Coder Pack] (minecraft.jar)

UCHIJAAA FML{8.0.99.99} [Forge Mod Loader] (forgeSrc-1.10.2-12.18.0.2010.jar)

UCHIJAAE Forge{12.18.0.2010} [Minecraft Forge] (forgeSrc-1.10.2-12.18.0.2010.jar)

UCHIJAAA mfr{1.0} [MineFunRevolution] (bin)

[23:35:58] [server thread/ERROR] [FML]: The following problems were captured during this phase

[23:35:58] [server thread/ERROR] [FML]: Caught exception from Forge

java.lang.RuntimeException: Duplicate stat id: "TranslatableComponent{key='stat.useItem', args=[TextComponent{text='[', siblings=[TextComponent{text='Iron Leggings', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}, TextComponent{text=']', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], style=Style{hasParent=true, color=§f, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}" and "TranslatableComponent{key='stat.useItem', args=[TextComponent{text='[', siblings=[TextComponent{text='Iron Leggings', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}, TextComponent{text=']', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], style=Style{hasParent=true, color=§f, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}" at id stat.useItem.minecraft.iron_leggings

at net.minecraft.stats.StatBase.registerStat(StatBase.java:111) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at net.minecraft.stats.StatList.initStats(StatList.java:214) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at net.minecraft.stats.StatList.reinit(StatList.java:356) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at net.minecraftforge.common.ForgeModContainer.mappingChanged(ForgeModContainer.java:459) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) ~[LoadController.class:?]

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) [LoadController.class:?]

at net.minecraftforge.fml.common.Loader.fireRemapEvent(Loader.java:1026) [Loader.class:?]

at net.minecraftforge.fml.common.registry.PersistentRegistryManager.injectSnapshot(PersistentRegistryManager.java:302) ~[PersistentRegistryManager.class:?]

at net.minecraftforge.fml.common.FMLContainer.readData(FMLContainer.java:327) ~[FMLContainer.class:?]

at net.minecraftforge.fml.common.FMLCommonHandler.handleWorldDataLoad(FMLCommonHandler.java:418) [FMLCommonHandler.class:?]

at net.minecraft.world.storage.SaveFormatOld.loadAndFix(SaveFormatOld.java:125) ~[saveFormatOld.class:?]

at net.minecraft.world.storage.SaveHandler.loadWorldInfo(SaveHandler.java:140) ~[saveHandler.class:?]

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:75) ~[integratedServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:124) [integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:496) [MinecraftServer.class:?]

at java.lang.Thread.run(Unknown Source) [?:1.8.0_66]

[23:35:58] [server thread/ERROR] [FML]: A fatal exception occurred during the server starting event

java.lang.RuntimeException: Duplicate stat id: "TranslatableComponent{key='stat.useItem', args=[TextComponent{text='[', siblings=[TextComponent{text='Iron Leggings', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}, TextComponent{text=']', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], style=Style{hasParent=true, color=§f, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}" and "TranslatableComponent{key='stat.useItem', args=[TextComponent{text='[', siblings=[TextComponent{text='Iron Leggings', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}, TextComponent{text=']', siblings=[], style=Style{hasParent=true, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], style=Style{hasParent=true, color=§f, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=HoverEvent{action=SHOW_ITEM, value='TextComponent{text='{id:"minecraft:iron_leggings",Count:1b,Damage:0s}', siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}'}, insertion=null}}], siblings=[], style=Style{hasParent=false, color=null, bold=null, italic=null, underlined=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null}}" at id stat.useItem.minecraft.iron_leggings

at net.minecraft.stats.StatBase.registerStat(StatBase.java:111) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at net.minecraft.stats.StatList.initStats(StatList.java:214) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at net.minecraft.stats.StatList.reinit(StatList.java:356) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at net.minecraftforge.common.ForgeModContainer.mappingChanged(ForgeModContainer.java:459) ~[forgeSrc-1.10.2-12.18.0.2010.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_66]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_66]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_66]

at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74) ~[guava-17.0.jar:?]

at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304) ~[guava-17.0.jar:?]

at com.google.common.eventbus.EventBus.post(EventBus.java:275) ~[guava-17.0.jar:?]

at net.minecraftforge.fml.common.LoadController.sendEventToModContainer(LoadController.java:235) ~[LoadController.class:?]

at net.minecraftforge.fml.common.LoadController.propogateStateMessage(LoadController.java:213) ~[LoadController.class:?]

at net.minecraftforge.fml.common.Loader.fireRemapEvent(Loader.java:1026) [Loader.class:?]

at net.minecraftforge.fml.common.registry.PersistentRegistryManager.injectSnapshot(PersistentRegistryManager.java:302) ~[PersistentRegistryManager.class:?]

at net.minecraftforge.fml.common.FMLContainer.readData(FMLContainer.java:327) ~[FMLContainer.class:?]

at net.minecraftforge.fml.common.FMLCommonHandler.handleWorldDataLoad(FMLCommonHandler.java:418) [FMLCommonHandler.class:?]

at net.minecraft.world.storage.SaveFormatOld.loadAndFix(SaveFormatOld.java:125) ~[saveFormatOld.class:?]

at net.minecraft.world.storage.SaveHandler.loadWorldInfo(SaveHandler.java:140) ~[saveHandler.class:?]

at net.minecraft.server.integrated.IntegratedServer.loadAllWorlds(IntegratedServer.java:75) ~[integratedServer.class:?]

at net.minecraft.server.integrated.IntegratedServer.startServer(IntegratedServer.java:124) [integratedServer.class:?]

at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:496) [MinecraftServer.class:?]

at java.lang.Thread.run(Unknown Source) [?:1.8.0_66]

 

Thank you for reply :)

Link to comment
Share on other sites

Dont know if that better, but same error...  :-[

String name = ((ResourceLocation)Item.REGISTRY.getNameForObject(itemold)).toString();
String newName = name.replaceFirst("minecraft:", "");
itemnew.setUnlocalizedName(newName);
itemnew.setRegistryName(new ResourceLocation(MFRMod.MODID, newName));
GameRegistry.addSubstitutionAlias(name, GameRegistry.Type.ITEM, itemnew);

 

freezing at loading :

6xCtuZx.png

 

and same error finished by :

[15:46:19] [server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED. Errors may have been discarded.

[15:46:19] [server thread/INFO] [FML]: The state engine was in incorrect state ERRORED and forced into state AVAILABLE. Errors may have been discarded.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • did you find any solutions? i have the same problem and also that mahito doesnt transform
    • Here's a simple example to solve this particular issue: public class ModArmorMaterials { public static final DeferredRegister<ArmorMaterial> ARMORS = DeferredRegister.create(Registries.ARMOR_MATERIAL, MyModName.MOD_ID); public static final RegistryObject<ArmorMaterial> COPPER = registerArmor("copper", Util.make(new EnumMap<>(ArmorItem.Type.class), enumMap -> { enumMap.put(ArmorItem.Type.BOOTS, 1); enumMap.put(ArmorItem.Type.LEGGINGS, 4); enumMap.put(ArmorItem.Type.CHESTPLATE, 5); enumMap.put(ArmorItem.Type.HELMET, 2); enumMap.put(ArmorItem.Type.BODY, 4); }), 12, SoundEvents.ARMOR_EQUIP_IRON, 0.0F, 0.0F, () -> Ingredient.of(Items.COPPER_INGOT)); private static RegistryObject<ArmorMaterial> registerArmor(String pGroup, EnumMap<ArmorItem.Type, Integer> pEnumMap, int pEnchantmentValue, Holder<SoundEvent> pEquipSound, float pToughness, float pKnockbackResistance, Supplier<Ingredient> pRepairIngredient) { List<ArmorMaterial.Layer> pLayerList = List.of(new ArmorMaterial.Layer(new ResourceLocation(pGroup))); return registerArmor(pGroup, pEnumMap, pEnchantmentValue, pEquipSound, pToughness, pKnockbackResistance, pRepairIngredient, pLayerList); } private static RegistryObject<ArmorMaterial> registerArmor( String pGroup, EnumMap<ArmorItem.Type, Integer> pEnumMap, int pEnchantmentValue, Holder<SoundEvent> pEquipSound, float pToughness, float pKnockbackResistance, Supplier<Ingredient> pRepairIngredient, List<ArmorMaterial.Layer> pLayerList) { return ARMORS.register(pGroup, () -> new ArmorMaterial(pEnumMap, pEnchantmentValue, pEquipSound, pRepairIngredient, pLayerList, pToughness, pKnockbackResistance)); } public static void register(IEventBus eventBus) { ARMORS.register(eventBus); } } Essentially, the TierSortingRegistry has been removed and so you now need to set up your own DeferredRegister. Please see the minecraftforge GitHub for more information; I found this solution through their issues (https://github.com/MinecraftForge/MinecraftForge/issues/9961)
    • How did I even leave that in there? I’ll try it in a bit, that very well could be it.
    • Greetings, I met a problem with my Forge server (47.2.0-1.20.1) that I can't join with the following line. (singleplayer world working fine) [net.minecraft.server.network.ServerGamePacketListenerImpl/]: Sharyna lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.toString()" because "p_130086_" is null   At first it was errored with packet size error, but I fixed that with the Connectivity mod, however, after that this popped up and can't find the source of it. Since the logs are big, I couldn't upload on paste.gg or other site ... so here it is (if the files are deleted, please notice me and I'll upload again. Debug and Latest log
  • Topics

×
×
  • Create New...

Important Information

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