Is it possible to use the creative tab from other mods?

Started by Nico_44 on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is it possible to use the creative tab from other mods?
Sat, 05/07/2022 - 08:41 (edited)

Hello I'am just asking if its possible for a mod to use a creative tab that's from another mod.

Edited by Nico_44 on Sat, 05/07/2022 - 08:41
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It should be if you edit the…
Sat, 05/07/2022 - 09:13

It should be if you edit the item code. Find this below, and edit the tab part if you know the tab name. You should be able to find it by opening the mod and looking at an item from the mod/tab you are trying to add items to.

super(new Item.Properties().tab(ModIdModTabs.TAB_NAME).stacksTo(64).rarity(Rarity.COMMON));
Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Doesn't seem to work
Sat, 05/07/2022 - 09:52

Doesn't seem to workImage

Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It has to be (ModId)ModTabs,…
Fri, 05/20/2022 - 19:56

It has to be (ModId)ModTabs, so in your case it'd be: "TreeBarkModTabs.BARK_TAB"

 

But to stop errors when compiling you'll need to import your mod, to do that:

  • First, export the source code of your mod "TreeBark" in a .jar, for that you can go to the Workspace menu and "Export deobfuscated mod"
  • Then you'll need to create a folder in your workspace folder named 'libs'.

Inside that folder you have to place your deobfuscated TreeBark mod.

Then you will need to edit the build.gradle file from MCreator and add 

flatDir { dirs 'libs' }

in the buildscript { repositories

So it should look like this:

buildscript {
    repositories {
        maven { url = 'https://maven.minecraftforge.net' }
        mavenCentral()
        flatDir { dirs 'libs' }
    }
    dependencies {
        classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
    }
}

Then you have to go down in the same file and search for the dependencies, and add this:

implementation fileTree(dir: 'libs', include: ['*.jar'])

So it should look like this; depending on the forge version you're using.

dependencies {
    minecraft 'net.minecraftforge:forge:1.18.2-40.1.0'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
}

To stop MCreator refreshing the build.gradle file, you'll have to manually compile your mod by going to console and using the build command:

 

The mod file will be saved in the folder MCreatorWorkspaces\your_project_folder\build\libs as "modid-1.0.jar"

 

Hope this helped you :)