#Items at a specific slot in ItemGroups

1 messages · Page 1 of 1 (latest)

prime tinsel
#

Hello, how can I make it so items are at a specific slot in a ItemGroup? I've seen mods like Ad Astra having smth like this.

jovial gazelle
copper dawn
#

For FabricItemGroupEntries you can entries.addAfter((ItemConvertible) item, List.of((ItemStack) stack), visibility) with the list of the stack being the item added after the specified item.

prime tinsel
#

I don't understand what you mean with that.

copper dawn
#

When registering items for your mod you can use the addAfter method in your listener to position the item after a reference item from vanilla.
So for example you add a custom sword item after the diamond sword in the combat item group.
on initialize run


private static void addItemsToCombatItemGroup(FabricItemGroupEntries entries)  {
    entries.addAfter(Items.DIAMOND_SWORD, CUSTOM_SWORD);
}```
prime tinsel
#

but that only adds the item after another item, in the ad astra mod there is a empty slots inbetween the items

#

something like this

jovial gazelle
#

i don't know exactly how they did it, but you can read through it and look.

prime tinsel
#

alr i'll see, ty

jovial gazelle
#

please do remember the licence should you chose to reuse code

prime tinsel
jovial gazelle
#

idk either

copper dawn
#

They seem to use a library to create a custom creative mode tab, namely com.teamresourceful.resourcefullib.common.item.tabs.ResourcefulCreativeTab. So I guess you could investigate that.

prime tinsel
jovial gazelle
prime tinsel
#

wdym

jovial gazelle
prime tinsel
jovial gazelle
prime tinsel
#

I guess i didn't look long enough, thanks