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] States on block predicate cannot be null

Aeltumn opened this issue · comments

Library version

1.8.0-24w14a

What module does this bug apply to?

DSL

What happened?

Prepare for me to report a lot of these, sorry!
I'm using the following code to generate a predicate to check a block's type:

block(vec3(0.relativePos, (-1).relativePos, 0.relativePos), io.github.ayfri.kore.arguments.types.resources.block("${team}_concrete"))

And this is being generated:

execute as @a[scores={intro_completed=1..}] at @s if block ~ ~-1 ~ minecraft:magenta_concrete{} run function crossfire:generated_scopes/generated_1990421361

Here because block's states value defaults to mutableMapOf() and

override fun asString() = "${asId()}${states.map { "[$it]" }.joinToString("")}${nbtData?.toString() ?: ""}"
always writes it to the output, there is always a {} in the output.

Arguably vanilla should not see magenta_concrete{} and magenta_concrete as different but with the {} the condition fails and it works without the {}.

Might start making PRs out of these if I find a lot of issues.

How can we reproduce this issue?

If you want the full context:

  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

No response

My issue is not duplicated

  • This is not a duplicate

Small bug, easy fix, will be fixed in 1.20.5-pre1 !