Tutorial: Change mod element names manually

Started by 91arrows on Sun, 06/26/2022 - 19:42

Topic category: User side tutorials

Last seen on 15:17, 6. Jul 2022
Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Tutorial: Change mod element names manually
Sun, 06/26/2022 - 19:42

this is a tutorial on how to change the names of the mod elements themselves in the workspace

it will also affect the names that appear in dropdowns

i have a mac computer so i'll be assuming you have one too because i don't know how to do it on anything else

1. go to your MCreator Workspaces folder

it goes like Finder > Go to Folder > Users/[your computer name]/MCreatorWorkspaces

then click on the workspace you wanna change

2. open the MCreator file ([your workspace].mcreator)

it's the file that ends in ".mcreator" and has the MCreator logo icon

make sure not to open it directly because that will open it as an MCreator workspace

you wanna use a text editor to get the raw code

Notepad and Sublime Text work, however TextEdit doesn't work because it converts everything into a rich text format (.rtf) which makes it so MCreator can't use it

drag your MCreator file onto the text editing program to open it

alternatively you can right click your file, then click "Open with", if the text editing program shows up then great, click on it

if not, go to "Other", click "Recommended Applications" and change it to "All Applications", check "Always Open With" if you want, select your text editor, and click "Open"

3. change the stuff

find the element that you wanna change the name of

on most programs, you can use Control+F or Command+F to bring up a search bar, then type the current name of your element in

go to where it says "name": "[original name]", then replace the original name with your new name

then go to where it says "registry_name": "[original registry name]", then replace the original registry name with your new registry name, all in lowercase and use underscores instead of spaces

4. copy the MCreator file to a backup

save the file to the location where it came from, if it asks to replace then select replace

then copy the file, move the copy to somewhere outside of your workspace folder, and rename the copy to the same name as your original MCreator file (for convenience)

it is important to make backups of your entire workspace too because MCreator can screw up

5. change the src

now the names of the elements in the workspace are changed but you still have to change the names in the code

from the workspace folder, go to src > main > java > net > mcreator > [your mod name]

now go to the category of whatever you renamed, look for a file that has the original name of the element, and open it with your text editor

you will see that there are instances of your original element name

let's use the name "MegachilePluto" as an example

throughout the document, you will see the name in camel case (MegachilePluto), and in snake case (megachile_pluto)

find all instances of the camel case name (preferably using Control+F / Command+F so you don't miss any), enable "Match case", and replace them with your new name in camel case

do the same with snake case, then save/overwrite your file

6. change the elements

now go back to your workspace folder and open "elements"

locate the element you wanna rename

all you have to do for this is rename the file

without this step, you won't be able to edit your element and it'll give a message saying there is no saved instance

7. refresh MCreator file

if you have your workspace open, go to File > Close this workspace

then drag the MCreator file into the MCreator window

alternatively you can click Open Workspace and find your MCreator file from there

now quickly copy your backup MCreator file and replace the actual one with the backup

your workspace should now be open with the element names changed

8. clean up leftovers

there are probably some recipes, procedures, or whatever else that still remember the old names of your elements

there are two ways you can clean them up: build the code, then go to all the elements with errors and replace the leftover elements with the new renamed ones, or regenerate code (click the fish bandage thing on the left of the build button), which i haven't tested but it probably works

but don't close out of MCreator while regenerating, that's how i lost half of my workspace

ok cool you're done bye

 

Last seen on 02:47, 17. Jul 2022
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
A lot of effort in this, for…
Wed, 06/29/2022 - 13:38

A lot of effort in this, for sure. I'm struggling to see how the outcome of this lengthy procedure is any different to simply duplicating the mod element, giving it a new name, and then deleting the original?