Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZenCode support #41

Open
rlnt opened this issue Feb 13, 2021 · 5 comments
Open

ZenCode support #41

rlnt opened this issue Feb 13, 2021 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@rlnt
Copy link

rlnt commented Feb 13, 2021

Hey there,

you may know me as a long time user of your glorious extension which saved me a ton of time while developing modpacks.

I know you didn't have much time lately as I also submitted other issues where you explained that.

But do you think it would be possible to develop a similar extension for newer versions of minecraft such as 1.16?

There would be a lot to do tho since the way Crafttweaker works changed a lot in that version. It would probably be a better idea to create a completely new extension called ZenCode or something since the language CT uses is ZenCode now and no longer ZenScript.
Also the syntax changed quite a bit since they are using item tags now and no longer bracket handlers.

The probe mod to dump all information can stay the same as it can be a separate mod for each version of minecraft. But you would need to update it as well because it needs to store everything as item tags and not as bracket handlers anymore.

I know this is a ton of work but there isn't something so useful like your extension for 1.16 yet and developing modpacks is a pain.
I'd be ready to become a backer of your project if you want to make some money with it and would happily donate if that helps you investing some of your time on that project.

Let me know your thoughts of that.

@Yesterday17 Yesterday17 added the enhancement New feature or request label Feb 13, 2021
@Yesterday17 Yesterday17 added this to the ZenCode milestone Feb 13, 2021
@Yesterday17
Copy link
Owner

Since my network condition is bad these days, it's hard to set up the latest dev environment for Probe. So I'll work on the extension(lexer and parser) first.

@Yesterday17 Yesterday17 self-assigned this Feb 13, 2021
@Yesterday17 Yesterday17 changed the title Support for newer versions ZenCode support Feb 13, 2021
@rlnt
Copy link
Author

rlnt commented Feb 13, 2021

Awesome!
I didn't expect such a fast answer and such enthusiasm. ❤️

So, you plan to add ZenCode support to the same extension?
If you need any reference, here is the official repository where they have a lot of their definitions which could become quite handy for the parser and the linter: https://github.com/ZenCodeLang/ZenCode

@kindlich
Copy link

📝 For getting info about Bracket Handlers:
CraftTweaker in 1.16 already provides ways for you to get a dump of all Bracket handlers using a special command /ct dumpBrackets. This will create several files in the <mc_root>/ct_dumps folder. For bracket handler completion, you could already use that.
The format of these files is one matching Bracket expression per line and one file per Bracket expression type. The bracket expressions inside these files are sorted alphabetically if my memory server correctly (in case some of your code may need that info as optimization).

💡 Info regardig ZC
We're also working on some docs for ZC (though personally I don't have that much time recently...), you can find an early version describing the syntax of some script files here:
https://zencode.blamejared.com/language/

📝 For getting the methods/globals and the like:
You can already get all registered classes using the CraftTweakerRegistry. From there as well as from the ZenClassRegistry that it exposes you should get access to all classes currently registrered to CraftTweaker.

Afaik we currently have not way to properly export the inner definitions so you would have to recreate some workings to get the definitions in your own format.
If you need some assistance there, or feel that something may be easier if it was instead added to CraftTweaker, don't hesistate to reach out 😉

⚠️ BEPs to take into consideration
You may also need to be careful, since currently we have some "special" Bracket Expression Parsers, one for recipetypes and one for Tags (not NBT tags, but Item/Block/Fluid tags, the new concept similar to oredicts).
Their handling inside ZC is different due to them having different return types depending on the type provided.
For example, the reciptype BEP returns the matching RecipeManager (typed, so ZC knows what special methods it has). This means that <recipetype:minecraft:crafting> would return CraftingTableManager whereas <recipetype:minecraft:smelting> would return FurnaceManager.

Tags on the other hand always return MCTag<T> but the T depends on the tag BEP. So <tag:items:minecraft:wool> would return MCTag<Item> whereas <tag:fluids:minecraft:water> would return MCTag<Fluid>

@rlnt
Copy link
Author

rlnt commented Feb 14, 2021

@kindlich Thanks a lot for visiting this issue and for the detailed explanation! ❤️
This project has a lot of potential and was a huge time-saver for 1.12 modpack creation. It would be nice if he manages to update it for the new version.

Yesterday17 added a commit that referenced this issue Feb 14, 2021
@rlnt
Copy link
Author

rlnt commented Feb 14, 2021

Hit me up on Discord if you need any help or testing @Yesterday17. I would be more than happy to help. :)
Relentless#3812

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants