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

Started by Nico_44 on Sat, 05/07/2022 - 08:32

Topic category: Help with modding (Java Edition)

Last seen on 19:21, 20. May 2022
Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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
Last seen on 01:37, 29. Jun 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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));
Last seen on 19:21, 20. May 2022
Joined Sep 2017
Points:

User statistics:

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

Doesn't seem to workImage

Last seen on 23:51, 28. Jun 2022
Joined Feb 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 :)