Posted December 28, 20177 yr We're stumped on getting this to work, despite considerable googling and experimentation. Here's the item declaration: @EventHandler public void preinit(FMLPreInitializationEvent event) { System.out.println("PRE-INITIALIZATION"); testItem = (Item)(new Item()); testItem.setRegistryName("stroutmod1_testitem1"); testItem.setUnlocalizedName(testItem.getRegistryName().toString()); testItem.setCreativeTab(CreativeTabs.MISC); System.out.println("Registered item: " + testItem.getRegistryName()); ForgeRegistries.ITEMS.register(testItem); } Note the println there showing us the registry name; when we launch, it shows "stroutmod1:stroutmod1_testitem1". Now we have a en_US.lang file at stroutmod1/src/main/resources/assets/stroutmod1/lang/en_US.lang. It's UTF-8 with no BOM, and contains: item.stroutmod1:stroutmod1_testitem1.name=Test Item Yet when we run the game, the item shows up as "item.stroutmod1:stroutmod1_testitem1.name" rather than "Test Item". Any idea what we're missing?
December 28, 20177 yr You are modid:modid_testitem1 but you do are modid:testitem1 : testItem.setRegistryName("testitem1");
December 28, 20177 yr 41 minutes ago, JoeStrout said: ForgeRegistries.ITEMS.register(testItem); Never register things like this.ForgeRegistries#<REGISTRY> are solely for querying & iterating over. If you want to register an object, use the RegistryEvent's. I believe that lang-file(en_US) have to be lower-case only(en_us) in 1.11+. @Choonster goes over why here. Also previously known as eAndPi. "Pi, is there a station coming up where we can board your train of thought?" -Kronnn Published Mods: Underworld Handy links: Vic_'s Forge events Own WIP Tutorials.
December 28, 20177 yr Author 48 minutes ago, Matryoshika said: Never register things like this.ForgeRegistries#<REGISTRY> are solely for querying & iterating over. If you want to register an object, use the RegistryEvent's Oops, looks like we must have found some old docs/samples. I'll look into this right away. 50 minutes ago, Matryoshika said: I believe that lang-file(en_US) have to be lower-case only(en_us) in 1.11+. That's it! Renaming the file to en_us.lang did the trick. Thanks very much!
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.