Jump to content

[1.12.2] Error:(14, 9) java: cannot find symbol: method setUnlocalizedName(java.lang.String)


Recommended Posts

Posted (edited)

I'm guessing this could be something I set up incorrectly, but I'm following https://wiki.mcjty.eu/modding/index.php?title=Basic_Block-1.12 and getting:

 

 Error:(14, 9) java: cannot find symbol
  symbol:   method setUnlocalizedName(java.lang.String)
  location: class com.hanleybrand.millwiz.blocks.FirstBlock

 

My class is pretty much identical to the one in the tutorial (obviously I used my own MODID, etc.), here's the src:
 

package com.hanleybrand.millwiz.blocks;

import com.hanleybrand.millwiz.MillenaireWizards;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class FirstBlock extends Block {

    public FirstBlock() {
        super(Material.ROCK);
        setUnlocalizedName(MillenaireWizards.MODID + ".firstblock");
        setRegistryName("firstblock");
    }
}


When I inspect the Block.class with Intellij (.~/[gradlepathtomc]/1.12.2-14.23.5.2768/stable/39/forgeSrc-1.12.2-14.23.5.2768.jar!/net/minecraft/block/Block.class) there isn't a method defined, and the IForgeRegistryEntry has a note about get/setRegistryName() being "valid replacement for the atrocious 'getUnlocalizedName().substring(6)' stuff that everyone does." 

When I setup the example mod (mcjty.modtut) for testing, it works and finds the class, but that's using forgeSrc-1.12-14.21.0.2385-PROJECT(ModTutorials1.12)-sources.jar, and in hat jar /net/minecraft/block/Block.java contains a setUnlocalizedName method.
 
The case is the same between the two source jars for net/minecraft/item/Item.java.
 
So, were get/setUnlocalizedName removed from Forge 1.12 at some point?  I searched the GitHub repo and the ChangeLog and didn't see any notes about it - I'm also using mappings = "stable_39" but I don't know if that would matter at all.

I guess my ultimate question is whether or not I made an error setting up my dev environment or if I can just delete the setUnlocalizedName(MillenaireWizards.MODID + ".firstblock"); line. 

Edited by hanleybrand
Posted

The mappings do indeed matter here. That function changed to setTranslationKey() in stable_39.

 

Another name that changed in that mapping was in CreativeTabs, which many tutorials cover. getTabIconItem(), which returns an ItemStack, is now createIcon().

  • Thanks 1
Posted (edited)

Thanks a lot - this was a surprisingly hard piece of info to find. Is there a place where the MCP changes are published (I've googled things like 'mcforge mcp changelog' to no avail, except finding the mcp GitHub repo and mcpbot but there doesn't seem to be a place that lists what the changes are between the snapshots)?  

Edited by hanleybrand
Posted

The MCPBot GitHub has something about 1.12.2 -> 1.13. Also https://gist.github.com/williewillus/353c872bcf1a6ace9921189f6100d09a

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

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



×
×
  • Create New...

Important Information

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