Jump to content

Recommended Posts

Posted

I am having an issue with porting a mod from 1.11 to 1.12.2. I think I have all the block and item registration setup correctly, but when I go to launch the game, it crashes right away and gives an error about existing registry names. I am not sure what I have to change to move past this. 

 

Crash log is here:  https://pastebin.com/pujTMbfa

 

I am not even sure what code I would need to provide to be more helpful on my end, so please let me know.

 

Thank you so much

Posted
7 hours ago, diesieben07 said:

You are calling setRegistryName twice on the same object, this is not allowed. We need to see your code to know where.

I solve the problem, but I just want to make sure I have my answer straight. When I register a Tile Entity, it is the same thing as registering a block correct? I.E. I do not need to register both a block and a tile entity for the same object.

Posted
29 minutes ago, Dongle12 said:

I solve the problem, but I just want to make sure I have my answer straight. When I register a Tile Entity, it is the same thing as registering a block correct? I.E. I do not need to register both a block and a tile entity for the same object.

No, it is not the same thing. TileEntities should be rare, but in either case, if you have one, you do need to register it.

However, that is not your problem here. Registering two items is not the same as registering the same thing twice. 

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.

Posted
2 hours ago, Draco18s said:

No, it is not the same thing. TileEntities should be rare, but in either case, if you have one, you do need to register it.

However, that is not your problem here. Registering two items is not the same as registering the same thing twice. 

 

Alright thanks, turns out my problem wasn't solved. I have tried limiting changing the code around to ensure that it doesn't register the same thing twice, but I think I do not fully grasp registering or am missing something and registering the block twice by accident.

 

The crash log starts with this: java.lang.IllegalStateException: Attempted to set registry name with existing registry name! New: BlockCompressedTorcherino Old: torcherino:blocktorcherino, and then points to line #9 of the BlockCompressedTorcherino class which has the following. 

 

public final class BlockCompressedTorcherino extends BlockTorcherino {
    public BlockCompressedTorcherino() {
        setRegistryName("BlockCompressedTorcherino");
        setUnlocalizedName("torcherino.compressed_torcherino");
    }

    @Override
    public TileEntity createNewTileEntity(final World world, final int i) {
        return new TileCompressedTorcherino();
    }
}

 

Line # 9 is the setRegistryName() function call.

 

From there I do the block registering in the CommonProxy(). The block registration code looks like the following: 

 

    @SubscribeEvent
    public static void registerBlocks(RegistryEvent.Register<Block> event) {
    	
    	event.getRegistry().register(new BlockTorcherino());
    	GameRegistry.registerTileEntity(TileTorcherino.class, "torcherino_tile");

    	event.getRegistry().register(new BlockCompressedTorcherino());
    	GameRegistry.registerTileEntity(TileCompressedTorcherino.class, "compressed_torcherino_tile");

    	event.getRegistry().register(new BlockDoubleCompresedTorcherino());
    	GameRegistry.registerTileEntity(TileDoubleCompressedTorcherino.class, "double_compressed_torcherino_tile");
    }

 

It runs into trouble at the line event.getRegistry().register(new BlockCompressedTorcherino()); 

 

I think this issue may stem from the BlockCompressedTorcherino extending the BlockTorcherino class which has code for setting registry name already in its constructor: setRegistryName("blocktorcherino"); 

 

 

Posted
19 minutes ago, diesieben07 said:

 

Alright thank you for the link to the code changes. I seem to have it working, although my solution seems a bit hacked together to me. I fixed it by removing the setRegistryName() call from the super and subclasses, and then in my CommonProxy(), I create new objects, and then set their appropriate names there. Is this a correct approach to fixing this issue?

 

Posted

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.

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.