Jump to content

[Sovled] Items not respecting/using Unlocalized Names?


Draco18s

Recommended Posts

So this has been bugging me for a little while, but as the name that showed up was accurate enough I just left it as it was.  Now though I'd like to actually fix it.

 

Here's the thing: all of items I've made for this one mod all display in-game with the same name: "Artifact"

I'd like to fix that so that the armor items are "Artifact Armor" ideally with material designations.  The only place this shows up is the creative inventory (as the item's name is later controlled by NBT data, which works great).

 

I have no language file entries for these items yet, and have removed the LanguageRegistry entries for them as well.  I've even gone so far as to remove the setUnlocalizedName from them, NOTHING causes it to change.  The items don't even inherit from each other.

 

All my code can be found here:

https://github.com/Draco18s/Artifacts/tree/master/draco18s/artifacts

 

DragonArtifacts.java is the main mod class and the two item classes are ItemArtifact.java and ItemArtifactArmor.java inside /item

Codebase hasn't change significantly from last night.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

thought you removed unlocalised name?

 

public ItemArtifact(int par1) {

                super(par1);

                setMaxStackSize(1);

                setNoRepair();

                weaponDamage = 0.0F;

                setMaxDamage(128);

                setCreativeTab(CreativeTabs.tabCombat);

                setUnlocalizedName("Artifact");

}

Link to comment
Share on other sites

I didn't push what I'm working with to Github.  The code is not currently working, so why would I push a broken version?

 

What I mean is that

setUnlocalizedName("Artifact");

line I've changed to

setUnlocalizedName("Banana");

and it still displays in-game as "Artifact":

 

artifact.png

artifact2.png

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

And....

 

Solved my own problem.

 

I figured that "Artifact" was a string that was coming from somewhere, so I did a workspace-wide search.

 

ItemArtifact#getItemDisplayName()

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

I have been reengineering my getItemDisplayName function to be language-good.

 

    public String getItemDisplayName(ItemStack par1ItemStack)
    {
    	String n = "";
    	if(par1ItemStack.stackTagCompound != null) {
    		if(doEnchName) {
    			if(par1ItemStack.stackTagCompound.getString("enchName").length() > 0)
				n += StatCollector.translateToLocal(par1ItemStack.stackTagCompound.getString("enchName")) + " ";
		}
		if(doAdjName) {
			if(par1ItemStack.stackTagCompound.getString("preadj").length() > 0)
				n += StatCollector.translateToLocal("pre."+par1ItemStack.stackTagCompound.getString("preadj")) + " ";
		}
		if(doMatName) {
			n += StatCollector.translateToLocal("mat."+par1ItemStack.stackTagCompound.getString("matName")) + " ";
		}
		if(!(doEnchName || doMatName || doAdjName)) {
			n += StatCollector.translateToLocal("type.Artifact") + " ";
		}
		n += StatCollector.translateToLocal("type."+par1ItemStack.stackTagCompound.getString("iconName"));
		if(doAdjName) {
			if(par1ItemStack.stackTagCompound.getString("postadj").length() > 0)
				n += " " + StatCollector.translateToLocal("post."+par1ItemStack.stackTagCompound.getString("postadj"));
		}
    	}
	if(n.length() < 1) {
		n = StatCollector.translateToLocal("type.Artifact");
	}
        return n;
    }

 

And entering all the unlocalized pieces to a localization file.  Downside is that I switched over to using vanilla's names for enchantments, so instead of "Efficient Gold Whatever" it's now "Efficiency Gold Whatever" but oh well.  Enchantments in item names makes them super long (as noted, there are config values for each piece).

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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

    • The game crashed whilst exception ticking world Error: java.lang.NullPointerException: Cannot invoke "net.minecraft.resources.ResourceLocation.equals(Object)" because "this.lootTableId" is null Error given is above. I was already playing for around 15 minutes and wasn't doing anything specific or even breaking anything when the crashed happened. This is update 1.19.2 forge: 43.2.23 Mod list: ESSENTIAL Mod (by SparkUniverse_) Traveler's Titles (Forge) (by YUNGNICKYOUNG) Resourceful Config (by ThatGravyBoat) Dynamic Lights (by atomicstrykergrumpy) TenzinLib (by CommodoreThrawn) Nature's Compass (by Chaosyr) Library Ferret - Forge (by jtl_elisa) Cold Sweat (by Mikul) Simple Voice Chat (by henkelmax) Waystones (by BlayTheNinth) Carry On (by Tschipp) [Let's Do] Meadow (by satisfy) Creeper Overhaul (by joosh_7889) AutoRegLib (by Vazkii) Moonlight Lib (by MehVahdJukaar) AppleSkin (by squeek502) Xaero's World Map (by xaero96) Rotten Creatures (by fusionstudiomc) YUNG's API (Forge) (by YUNGNICKYOUNG) Village Artifacts (by Lothrazar) Right Click, Get Crops (by TeamCoFH) Supplementaries (by MehVahdJukaar) Automatic Tool Swap (by MelanX) Better Third Person (by Socolio) Supplementaries Squared (by plantspookable) Traveler's Backpack (by Tiviacz1337) Caelus API (Forge/NeoForge) (by TheIllusiveC4) Creatures and Beasts (by joosh_7889) Architectury API (Fabric/Forge/NeoForge) (by shedaniel) Quark Oddities (by Vazkii) Origins (Forge) (by EdwinMindcraft) Villager Names (by Serilum) GeckoLib (by Gecko) Realistic Bees (by Serilum) Illuminations Forge 🔥 (by dimadencep) Serene Seasons (by TheAdubbz) Critters and Companions (by joosh_7889) [Let's Do] Bakery (by satisfy) Falling Leaves (Forge) (by Cheaterpaul) Jade 🔍 (by Snownee) Collective (by Serilum) TerraBlender (Forge) (by TheAdubbz) [Let's Do] API (by Cristelknight) Towns and Towers (by Biban_Auriu) More Villagers (by SameDifferent) Biomes O' Plenty (by Forstride) Goblin Traders (by MrCrayfish) Corpse (by henkelmax) Tree Harvester (by Serilum) Balm (Forge Edition) (by BlayTheNinth) Mouse Tweaks (by YaLTeR) Sound Physics Remastered (by henkelmax) Xaero's Minimap (by xaero96) Just Enough Items (JEI) (by mezz) Terralith (by Starmute) Quark (by Vazkii) [Let's Do] Vinery (by satisfy) [Let's Do] Candlelight (by satisfy) Repurposed Structures (Neoforge/Forge) (by telepathicgrunt) Dusty Decorations (by flint_mischiff) Immersive Armors [Fabric/Forge] (by Conczin) Serene Seasons Fix (by Or_OS) Shutup Experimental Settings! (by Corgi_Taco) Skin Layers 3D (Fabric/Forge) (by tr7zw)
    • Make sure Java is running via Nvidia GPU https://windowsreport.com/minecraft-not-using-gpu/  
    • Also make a test with other Custom Launchers like AT Launcher, MultiMC or Technic Launcher
    • Embeddium and valkyrienskies are not working together - remove one of these mods With removing Embeddium, also remove Oculus, TexTrue's Embeddium Options and Embeddium Extras Or use Rubidium instead
  • Topics

×
×
  • Create New...

Important Information

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