CraftTweaker

CraftTweaker

151M Downloads

[1.14+] Big 'Ol Feature Request List

NielsPilgaard opened this issue ยท 18 comments

commented

These requests are mostly QoL features, I know there are ways of doing the same, but those ways are less elegant.

  • MCTag.IsValidItemTag() Returns true if the Tag exists and is an itemTag, otherwise false.
  • loadedMods["modname"] A way of checking if a mod exists in the instance, the main purpose for this would be to disable mod specific scripts if a mod is removed by the user.
  • craftingTable.getByName(string) - Returns recipe or null if no such recipe exists. Useful for automatic name generation functions. Returning true or false, or 0 or 1 would be just fine too.
  • MCTag.first - A method that returns the first element or null from a tag.
  • MCTag.removeItem(VarArg) - Alias for removeItems, which is a bit more intuitive for removing single items.
  • IItemStack.owner - A method that returns the name of the mod that owns the IItemStack.
  • Global/static variables, accessible anywhere without having to import them.
  • If the above is not possible (or wanted), ability to import variables between scripts.
  • /ct tag(s) - Copies first or all tags from the held item to the clipboard.
  • /ct inventory - Like /ct hand for the entire inventory.
  • /ct inventory tag(s) - Like /ct hand fo the entire inventory. Copies first or all tags from items in the inventory to the clipboard
  • /ct recipe - Prints the CrT syntax for the recipes of the held item, and copies it to the clipboard
  • IItemStack.transformDamage(int) - Uses int amount of durability on item, or breaks the item if it does not have enough durability

I'm sure I can come up with more things, so... Please leave this open unless it's annoying :P

commented

Yep, MCTag.removeItems() does accept both IItemStack and IItemStack[]

commented

A method that removes one IItemStack from a tag, as opposed to an array, which is the only method atm

The method is technically vararg, so you shouldn't need the [], try and see if that works?

commented

Sure, but it didn't 6 weeks ago.

commented

If it doesn't that's a reason for an issue ๐Ÿ˜›

commented

It's taking a while to test because I also moved a few functions, and ZC shits itself when you do that apparently :P
Edit: Moving functions was not the issue I was having.

commented

Here's the log if you're curious: https://gist.github.com/NillerMedDild/32bcc1e3d2e862699eb4ae6e4ec393c1
I'm fairly certain a restart will fix it. I reloaded 4 times to produce that logsize, fyi.

commented

May I add to the wishlist getItemByUnlocalizedName() and his bro-method getItemByRegistryName ? Would be very useful for mods like GregTechCE, where some "Electric Piston (LV)" hides behind the cryptic <gregtech:meta_item_1:32640>, while it's unlocalized name is gregtech:metaitem.electric.piston.lv

commented

There is no easy way to get an item by its unlocalized name without iterating the whole item list, and even then, unlocalized names aren't necessarily unique, 2 different items can share the same unlocalized name.

As for registry name, that already exists

BracketHandlers.getItem(name);

commented

Say, is there a way for me to mimic MCTag.IsValidItemTag()? I need it before I can release the unification update for E4 ^^'

commented

MCTag.IsValidItemTag()
building for CF now,

<tag:minecraft:wool>.isItemTag
<tag:minecraft:wool>.isBlockTag
<tag:minecraft:wool>.isEntityTypeTag
commented

Thanks a lot!

commented
MCTag.first

This isn't the same every single time, on one load <tag:minecraft:wool> produced orange wool, the next load it was white wool.

Saying this, if mods are using the first item specifically, like thermal expansion used to do, then it should be fine

commented
 /ct recipe - Prints the CrT syntax for the recipes of the held item, and copies it to the clipboard

this on is actually quite a bit problematic now, since I don't know how recipes are meant to look, in terms of modded recipes, since they are part of the same list

commented

I was thinking it should display crafting table recipes only.

commented

Nice work Jared, thank you :)

commented

Can be closed.

commented

Global/static variables, accessible anywhere without having to import them.

// somefile.zs
public class Constants {
    public static var test as string = "Hello World";
}
// someOtherFile.zs
println(Constants.test);
commented

/ct recipe - Prints the CrT syntax for the recipes of the held item, and copies it to the clipboard

Added in this branch which will be pulled into the 1.16 branch soon.
https://github.com/CraftTweaker/CraftTweaker/tree/feature/recipeprinting

Example output:
https://gist.github.com/jaredlll08/86e1e1ebd0bf9e9980e9e724225b3412

unknown recipes appear as:
https://gist.github.com/jaredlll08/86e1e1ebd0bf9e9980e9e724225b3412#file-crafttweaker-log-L703

and mods can register their own writers for their own recipes.

With that I believe this issue is done, kinda late I know but oh well.

Will close it when recipe printing in merged.