Jump to content

Recommended Posts

Posted

So i searched and couldn't find anything. I have about 5 or 6 small mods and almost all of them spawn in a custom version of a vanilla mob. Each mob in-game shows the regular names when you are killed by them or spawn eggs. (Killed by Creeper. Killed by Zombie, etc)

 

Well this one mod, I cannot figure out why the name of my mob shows as for example, "Killed by entity.rebelsnowman.name" I use basically identical code for all of them and this one out of 6 doesn't work and it's making my brain explode that I can't figure it out.

 

LanguageRegistry.instance().addStringLocalization("entity."+COREUtil.modName5 +".EntityMorphSnowman.name", COREUtil.entityNameSnowman0);

 

Help please?

Posted

I tried that. I'm not sure what the problem is. All of my mods use this exact same code with the COREUtil.modName<NUMBER> in them. I tried it without using my COREUtil like you mentioned above but it always looks the same in-game.

 

I've tried writing about 5 different ways and to no avail. I just can't comprehend why ALL 5 of my other mods this code works fine but this one doesn't.

 

@Mod(modid = COREUtil.modID5, 
name = COREUtil.modName5, 
version = COREUtil.versionNumber5, 
dependencies = COREUtil.modDependancies5)

@NetworkMod(clientSideRequired = true, serverSideRequired = false)

public class RebelSnowmenBase
{
public static boolean configFireArrows;
public static int configHealth;


@SidedProxy(
		clientSide = COREUtil.proxyClient,
		serverSide = COREUtil.proxyServer)
public static CommonProxy proxy;




@EventHandler
    public void preModInit(FMLPreInitializationEvent event) 
{

        /**
         * Handles configuration file
         */
        Configuration config = new Configuration(event.getSuggestedConfigurationFile());

        // loading the configuration from its file
        config.load();
        

        configFireArrows = config.get(Configuration.CATEGORY_GENERAL, "FIERY_ARROWS_AT_NIGHT", false).getBoolean(true);
        configHealth = config.get(Configuration.CATEGORY_GENERAL, "SNOWMAN_MAX_HEALTH", 15).getInt();

        // saving the configuration to its file
        config.save();
    }

@EventHandler
    public void modInit(FMLInitializationEvent event) 
{
	/**
	 * Register MorphSnowman & Create Spawn Egg
	 */
    	
        EntityRegistry.registerGlobalEntityID(EntityMorphSnowman.class, "RebelSnowman", EntityRegistry.findGlobalUniqueEntityId(), 0xFFFFFF, 0x000000);
        EntityRegistry.registerModEntity(EntityMorphSnowman.class, "RebelSnowman", 3, this, 64, 3, true);
        
	EntityRegistry.addSpawn(EntityMorphSnowman.class, 5, 1, 1, EnumCreatureType.monster, BiomeGenBase.taiga, BiomeGenBase.taigaHills);


	LanguageRegistry.instance().addStringLocalization("entity."+COREUtil.modName5 +".EntityMorphSnowman.name", COREUtil.entityNameSnowman0);
    }
    
@EventHandler
    public void modsLoaded(FMLPostInitializationEvent event) 
{
    	
    }

    
}

Posted

Thanks for your willingness to help but nothing is working.

 

LanguageRegistry.instance().addStringLocalization("entity.rebelsnowmen.RebelSnowman.name", "RebelSnowman");

 

I've switched things around a few dozen times to make it work and to no avail. I'm just going to scrap the project. I'm too frustrated with why my other mods work perfectly like this and this one doesn't.

 

Thanks.

Posted

I have 6 mods that all do different things to different mobs. But the language registry code is basically the same. But I figured it out now. I spent two days trying to find a complex issue to my coding and it turns out it was something simple that I was overlooking.

  • 3 months later...
Posted

Could you share what the solution was?

 

I'm having the same problem and cannot figure out what is wrong.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

The main issue is registering the entity twice.

Then, the EntityRegistry.registerModEntity method appends the modid before the entity unlocalized name.

Finally, the LanguageRegistry is deprecated. You should use the vanilla way with .lang files.

Posted

When I get home, I'll dig around and try that method. 

 

If you have a chance, could you provide an example of the working part?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Let's say you want to register:

EntityRegistry.registerModEntity(CustomEntity.class, "RegistrationName", 1, this, 80, 3, true);

Then, assuming your mod id is "modid":

In a .lang file, located in assets/modid/lang/
entity.modid.RegistrationName.name=Human language-dependent readable name

You need to name the .lang file with language code, like "en_US".

I prefer using UTF-8 encoding for the .lang file, and leave a blank line at the beginning.

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

    • Please read the FAQ and post logs as described there.
    • Upon starting the server I get; [main/ERROR] [minecraft/Main]: Failed to start the minecraft server net.minecraftforge.fml.LoadingFailedException: Loading errors encountered: [     Framework (framework) has failed to load correctly §7java.lang.NoClassDefFoundError: net/minecraft/client/gui/components/toasts/Toast ] I suspect there is a (possibly a few) client-only mods installed on my server. Any help would be appreciated! (Yes I know there are a lot of mods...) Here is the crash log:   https://paste.ee/p/pRz5mhMl#s=0
    • That's basically what the failure does, my apologies for failing to specify.  It just tries again on the next tick until it detects the entities for that chunk are loaded, and then tries to load the entity.  From there it gets into different failure states depending on what goes wrong, but in short, if the entity fails to load once the entity list becomes available, the request is cleared and must be resubmitted by the end user.  There should be few cases where that actually happens. Yes, that is my understanding of forceloading.  That's why on a successful summon, it removes the forceload.  Otherwise it does just leave the chunks loaded long term. Thank you for your help, any knowledge is useful!  I don't often mess with forceloading and my prior experience is 1.16 so I'm also a bit out of my depth haha.
    • I will have to do more research about 1.18 chunk loading. You were unclear about how your code manages with the entity load failure. If you simply used a loop, I suggest submitting a tick task to the next tick which does the same thing, checking if the entities are loaded and if so teleporting the right one else submitting another tick task etc. Also I think forceloading permanently force loads the chunk, and it only starts to unload when you make a subsequent call to mark the chunk as not forceloaded. I may be completely wrong, I dont know much about 1.18, most of my experience is 1.20. Good luck I hope you figure it out after all this time 😅
    • i managed to fix it by reinstalling the modpack and re-add all the extra mods I've had previously.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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