Jump to content

[1.13.2][SOLVED] Registries limits?


Krevik

Recommended Posts

1. Stop using BlockBase.

2. Stop using ItemBase.

3. Where did you register your registerBlocks and registerItems method? Are they being called?

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

7 hours ago, DavidM said:

1. Stop using BlockBase.

2. Stop using ItemBase.

3. Where did you register your registerBlocks and registerItems method? Are they being called?

BlockBase and ItemBase are used to register block and items easier, the code is easier to read, than vanilla one - aren't some conventions pointing that the code should be easy to read? Without them I would have to call Block.Properties.create, every time I create new Block. The code is pretty long then, so I created some more simple constructor.

 

They're all registred in RegistryHelper.
 

    @SubscribeEvent
    public static void registerBlocks(final RegistryEvent.Register<Block> event){
        final IForgeRegistry<Block> registry = event.getRegistry();
        for(Block block: KBlocks.blockRegistryList){
            registry.register(block);
        }
    }

    @SubscribeEvent
    public static void registerItems(final RegistryEvent.Register<Item> event){
        final IForgeRegistry<Item> registry = event.getRegistry();
        for(ItemBlock itemBlock:KBlocks.itemBlocksRegistryList){
            final Block block = itemBlock.getBlock();
            final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block);
            ItemBlock itemBlock1 = (ItemBlock) new ItemBlock(block,new Item.Properties().group(itemBlock.getGroup())).setRegistryName(registryName);
            registry.register(itemBlock1);
        }
        for(Item item: KItems.itemsToRegister){
         registry.register(item);
        }
        registry.register(new ItemBlock(KBlocks.KATHARIAN_PORTAL,new Item.Properties().group(KathairisItemGroups.kathairis_building_blocks)).setRegistryName(KBlocks.KATHARIAN_PORTAL.getRegistryName().toString()));
    }

Yes, register method are being called, cause as I said most of blocks works, just some of them are skipped. Even if I try to register them manually, they're not succesfully registred

Edited by Krevik
Link to comment
Share on other sites

22 minutes ago, Krevik said:
7 hours ago, DavidM said:

1. Stop using BlockBase.

2. Stop using ItemBase.

3. Where did you register your registerBlocks and registerItems method? Are they being called?

BlockBase and ItemBase are used to register block and items easier, the code is easier to read, than vanilla one - aren't some conventions pointing that the code should be easy to read? Without them I would have to call Block.Properties.create, every time I create new Block. The code is pretty long then, so I created some more simple constructor.

1. No. In fact, the convention in terms of modding is against using BlockBase and ItemBase. They are an anti-pattern. I've linked some posts from others down below explaining why Block/ItemBases should not be used:

http://www.minecraftforge.net/forum/topic/68881-onblockactivated-not-being-called/?tab=comments#comment-332831

http://www.minecraftforge.net/forum/topic/68429-ore-variant-textures-not-working-properly/?tab=comments#comment-330456

In conclusion, there is already a BlockBase, it is called Block; you shouldn't be using inheritance just to write less code; extending from bases prevents you from extending from other stuff.

 

2. Check your log. Are there any errors during registry? If all of your blocks are in the list, then the problem is probably that some blocks failed to register. Try adding debug lines.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Link to comment
Share on other sites

11 minutes ago, DavidM said:

1. No. In fact, the convention in terms of modding is against using BlockBase and ItemBase. They are an anti-pattern. I've linked some posts from others down below explaining why Block/ItemBases should not be used:

http://www.minecraftforge.net/forum/topic/68881-onblockactivated-not-being-called/?tab=comments#comment-332831

http://www.minecraftforge.net/forum/topic/68429-ore-variant-textures-not-working-properly/?tab=comments#comment-330456

In conclusion, there is already a BlockBase, it is called Block; you shouldn't be using inheritance just to write less code; extending from bases prevents you from extending from other stuff.

 

2. Check your log. Are there any errors during registry? If all of your blocks are in the list, then the problem is probably that some blocks failed to register. Try adding debug lines.

Yea, been checking logs really long actually. They're just skipped, no errors. Katharian_Multi_Grass, blue_cloud_bricks and yellow_cloud_block. Blue_Cloud_bricks and Yellow_Cloud_Block are extending BlockBase, so the same registration methods are used.

Edited by Krevik
Link to comment
Share on other sites

Maybe try something like this in your main class:

 

 // Register Items
        FMLJavaModLoadingContext.get().getModEventBus().addGenericListener(Item.class,this::onItemsRegistry);
  private void onItemsRegistry(final RegistryEvent.Register<Item> itemRegistryEvent) {
        LOGGER.info("Registering Items...");
        ModItems.register(itemRegistryEvent);
    }

 

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



×
×
  • Create New...

Important Information

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