Jump to content

Recommended Posts

Posted

Hello,

I am working on getting my mod ready for an alpha release. One of the things I would like to polish before doing so is the order the items and blocks appear in the creative tab. There seems to be no rhyme or reason to it. I thought it might be the order in which I define the objects, but that doesn't seem to be the case, as the order doesn't change when I move the object definition around in the iteminit class. Can anyone help me with this?

 

Here is a link to the project on github: https://github.com/skiprocks999/Amulets-of-Infinity/tree/Block-Library

Posted
33 minutes ago, skip999 said:

Would I put it in the init package or does it go in the mod class?

It doesn't matter where you put the class, packages are just for sorting.

It's sad how much time mods spend saying "x is no longer supported on this forum. Please update to a modern version of Minecraft to receive support".

Posted

Okay so out the door I have run into a problem. I go to extend "CreativeTabs", and the class does not exist. The only two options I am presented (three if you include the create a class one) is either "CreativeScreen" or "CreativeSettings". Am I taking what the post is saying to literally? I am in 1.15.2 for my mod version, so its possible the name has just changed.

Posted

Okay so on the forum post diesie listed above, the override appears to include having a list where you manually put in every item in the mod. I am using defferedregistries, so where it states:

 

              List<Item> items = Arrays.asList(your_item_1, your_item_2, ...);

 

could I simply have:

 

             List<Item> items = null;

             items.addAll(ITEMS);

 

this way when I add or remove an item I do not have to also modify the creative tab extension class in my main mod class

 

(for reference the defferedregister for my items is named ITEMS)

Posted

So I have hit a bit of a snag. I was able to get it working for the item library just fine. However, I cannot seem to figure out how to get it to work for my block library. The main issue is that I am using deferredregistries, so I only have the blocks defined in the init class. In my main mod class, I have a method that generates the block items for me, which I have listed here:

 

    public static void onRegisterItems(final RegistryEvent.Register<Item> event) {
                
        final IForgeRegistry<Item> registry = event.getRegistry();
        
        List<BlockItem> blockItems = new ArrayList<BlockItem>();
        
        BlockInit.BLOCKS.getEntries().stream().map(RegistryObject::get).forEach(block ->   {
            final Item.Properties properties =
                    new Item.Properties().group(ContInfBlockLibItemGroup.itemGroupInstance);
            final BlockItem blockItem = new BlockItem(block,properties);
            blockItem.setRegistryName(block.getRegistryName());
            blockItems.add(blockItem);
            registry.register(blockItem);
        });
        
        logger.debug("Registered BlockItems");
    }

 

I have attempted to get a list of the block items out of the method, but to no avail. How would I go about doing that?

 

Posted

Here is my code for extracting the list of blocks from the registry:
            Object[] listOfBlocks = BlockInit.BLOCKS.getEntries().stream().map(RegistryObject::get).toArray();
            List<Block> blockItems= new ArrayList<Block>();
            for(int i = 0; i < listOfBlocks.length;i++) {
                blockItems.add((Block)listOfBlocks);
            }

I am not seeing any option for blocktoitem on any of the entries in the blockItems list, nor can I find any documentation online on how I would use it. How would I apply it? And where would I apply it?

Posted

I am not getting that as an option for the block instances. Is it an external method I call and pass in the block instance? If so, what do I call it from?

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.