Posted December 17, 20177 yr 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
December 17, 20177 yr Author 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.
December 17, 20177 yr 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.
December 17, 20177 yr Author 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");
December 18, 20177 yr Author 19 minutes ago, diesieben07 said: Problematic code, issue 4, 10 and 13. Indeed. 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?
December 18, 20177 yr Code style issue 1 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.