Started by
Makeight
on
Topic category: Help with Minecraft modding (Java Edition)
Minecraft 1.19.2
MCreate 2023.2
How can I make a resident change their profession on the workbench from MrCrayfish's Gun Mod?
Topic category: Help with Minecraft modding (Java Edition)
Minecraft 1.19.2
MCreate 2023.2
How can I make a resident change their profession on the workbench from MrCrayfish's Gun Mod?
You could presumably just lock the procedure, and replace the block reference with the mod id and registry name from the modded block you want. (Probably make sure to include a check in your procedure that the mod is loaded, otherwise this could cause issues if the procedure attempts to run without the mod installed.)
How can I do it? I don't understand when can I get this procedure
I understand how to do it in json, but not in java
Bump
You would make the villager code like normal, and use some sort of placeholder for the profession block. Then you would lock all the code for that mod element, find the places where it references the placeholder, and replace it with the registry name of the modded block you want it to use. (Keeping in mind this will likely break if the other mod isn’t installed.)
Can you give me an example of how I can do this?
Here's an example of what the locked mod element looks like; you would need to replace the highlighted block with the registry name from the mod. That being said, this actually looks more difficult than I initially thought. Villager professions are one of the main init files, which means they're always regenerated regardless of whether or not you lock them; you would have to do this last, and the suspend the regeneration of everything else to make sure it doesn't revert to the placeholder block. What's more, it looks like you'll likely need to import something or other, and I'm not entirely clear on the syntax. It's not just the simple copy-and-paste sort of job I thought, but it may still be possible. When all else fails, just throw stuff at the wall and see if it compiles.
I can reference to another mod in the import, right? In this case, the one I need should appear in Blocks
I think so? Again, I'm not entirely sure how you'd reference this. It's importing blocks already, but possibly not the ones provided by the mod you wanted to reference. May be worth looking into some examples in Github to get an idea of how to do this.