CC: Tweaked

CC: Tweaked

57M Downloads

[1.16.4] CraftTweaker Support not working for adding Tools

Flexico opened this issue ยท 18 comments

commented

MC 1.16.4
CC:T 1.94.0
CT 7.0.0.27

I'm trying to follow the instructions on this page: https://github.com/SquidDev-CC/CC-Tweaked/wiki/CraftTweaker to add turtle support for different tools from mods, but I keep getting errors like "Invalid bracket expression: no prefix minecraft" or whatever mod name in place of "minecraft". For example, I'm using the following code to attempt to allow turtles to equip a netherite pickaxe:

dan200.computercraft.turtle.addTool("minecraft:netherite_pickaxe", <minecraft:netherite_pickaxe>);

but I just get errors and I'm not sure what else to do!

commented

It appears that CT now requires you to write <item:minecraft:netherite_pickaxe> instead. I've updated the documentation accordingly.

Note that this won't work right now due to another bug in how upgrades are registered.

commented

Welp, adjusted the code and it doesn't throw any errors, but like you said, still doesn't work. >< Where's the page about the other bug?

commented

I didn't create an issue for the other bug, as I only found it when debugging this one. There's a tiny description in the above commit (2c9f51d), but it's fixed now.

Hoping to get a release out later today which should contain this fix.

commented

Dang, you're knocking out bugs at an alarming rate! Keep it up~ <3

commented

Thank you!

Though alternatively, there's an alarming number of bugs which need fixing :p.

commented

Aha, it works now! Only problem is they're named things like "upgrade.bluepower.sapphire_pickaxe.adjective" and I can't figure out how to add a proper name!

commented

Oh, sorry! I entirely forgot about the fact that you'd need translations. I've added this to the wiki page too - basically you'll need to create a resource pack and add assets/myresourcepack/en_us.json with the following contents:

{
      "upgrade.bluepower.sapphire_pickaxe.adjective": "Mining (Sapphire)"
}

(or similar, not sure what you want to actually call the turtle).

commented

Ok, one last question (I hope) -- Is there a way to order them in JEI? As it is the order looks completely random, even though my script and translation files were very well-organized.

commented

Can I not add the translation through the script file? Asking because I'm likely to run a server with this script and I'd rather not have a resource pack tacked on if I can help it.

commented

I'm afraid not. Looking through the documentation, they suggest creating the language files when working with ContentTweaker, so I suspect the same is for turtle upgrades.

If you're running a server you could set up a server resource pack, but it's a bit of a dodgy solution. I guess the recommended solution would be to distribute the resources as part of the server's pack.

commented

All right, thanks for the info! ^_^ Maybe I'll name it "Important Code Pack" or something so they don't disable it. XD

commented

All right, thanks for the info! ^_^ Maybe I'll name it "Important Code Pack" or something so they don't disable it. XD

I'd just be honest about what the pack is and call it a custom item localisation pack.

commented

That works too! :3

commented

I'm afraid there isn't. Upgrades are stored in a map, so they're pulled in the order they're added to the map.

I could switch to a linked hash map which would ensure they're added in insertion order though. I'll reopen this to remind me.

commented

Oh cool! =D

Ok, one more thing -- Im trying to rename the "Mining" turtles to "Diamond Mining" turtles since there are now more tool options, but the pack doesn't seem to affect those, even though I checked in the cc:tweaked jar file to get the correct name: "upgrade.minecraft.diamond_pickaxe.adjective": "Diamond Mining"
All the tools I added worked though~

commented

Hrrm, that's odd. I'd expect user resource packs to override mod ones in this case. I guess a janky workaround would be to remove the default one and register a minecraft:diamond_pickaxe2 with your own language key.

commented

Ah, figured out that the renaming wasn't working because I had the lang files in assets/minecraft instead of assets/computercraft. D'OH!

commented

Ok, for the past week or so, I've been getting a wall of errors whenever I load up a world with the script -- it lists all the tool addons I made and says an upgrade of that name already exists.
2021-02-05_19 57 40
I tried taking the script file out of the folder in case there were multiple copies of it somehow, but then it just didn't load. What could cause this?