Ayfri / Kore

A Kotlin library to generate Datapacks for Minecraft Java.

Home Page:https://kore.ayfri.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] Generated functions are placed in wrong folder

Aeltumn opened this issue · comments

Library version

1.8.0-24w14a

What module does this bug apply to?

DSL

What happened?

In the datapack that's generated all generated mcfunction files are called generated_scopesgenerated_61426020.mcfunction instead of being in a subfolder called generated_scopes. Other functions do use the folder when referencing them, e.g. crossfire:generated_scopes/generated_1274247563.

Changing the configuration to include a / after the folder did not help since it made all other functions use // when referencing.

Full code is available at https://github.com/Aeltumn/realms-maps and can be run to build everything. Just started using this library so I might be using some things wrong. 😅
Example of what the output functions folder looks like:
image

From a brief look at the code I reckon this line

zipOutputStream.putNextEntry(ZipEntry("data/${function.namespace}/functions/${function.directory}${function.name}.mcfunction"))

might need to include the /? Although I couldn't find where the other functions know how to reference it and why that's different from where the actual file ends up.

How can we reproduce this issue?

Don't know if you want to fully re-create my environment but you can if you want:

  1. Go to https://github.com/Aeltumn/realms-maps and clone it.
  2. Run ./gradlew :crossfire:run (make sure to use Java 21)
  3. Look at the created pack in /out.

Extra information

Using Windows if that's relevant.

My issue is not duplicated

  • This is not a duplicate

That's surely a bug I didn't catch, I'm looking if I can reproduce the bug and try to make a fix.

Thanks for using Kore and reporting a bug you found also, that really helps the project ! 🚀

I've manage to reproduce the bug, and fix it. I also added unit tests for checking if the entries are correctly present in the zip file.
You will be able to use the fixed version once I release the update for 1.20.5-pre1 (as I'm in the middle of working on it and it would be complex to rollback to release an update for me), it should be pretty quick.

As a temporary fix, you can generate the datapack not in a zip using the generate() function.

Thank you for looking into it so quickly! I'll use generate() for now.