SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.06k stars 368 forks source link

1.21 Support #6798

Closed APickledWalrus closed 3 months ago

APickledWalrus commented 3 months ago

Description

This PR intends to add support for Minecraft 1.21.

I have added a new testing environment for Paper 1.21. Skript compiled without issue (at the time of writing this).

However, without this PR, Skript fails to load on Paper 1.21 (and presumably any further new releases) due to ItemStack changes. ItemStacks can no longer represent block-only materials (that is, materials such that !Material#isItem). This is only more of a push for us to make strong changes regarding the ItemType/ItemStack/BlockData trio, but an ideal fix would likely require a significant time investment to completely rework the alias/ItemType system.

Fortunately, I have managed to get Skript loading and tests passing without too many changes. One significant change is that ItemStack#getRandom is now nullable. There is no way to avoid this. There are now likely instances of unsafe getRandom usage that need fixed (I have not taken the time to resolve this yet). Internally, it is now the case that an ItemData may not have an ItemStack. This item stack was likely unused in many cases as these datas represented blocks. With all of these changes, this PR needs extensive testing to determine how


Target Minecraft Versions: 1.21+, though these ItemType/ItemData changes apply to all versions (which we may want to discuss) Requirements: none Related Issues:

PetyXbron commented 3 months ago

Yeah! This works perfectly for me. Great work! Big up

csd4ni3l commented 3 months ago

Works perfectly for me aswell, please merge it, so auto update works instead of using a custom version

Moderocky commented 3 months ago

Works perfectly for me aswell, please merge it, so auto update works instead of using a custom version

The next public beta is scheduled for the 1st of July (in 3 days) where you'll be able to download it from the GitHub. There'll be about 15 days for people to review and give feedback before the next stable version is released after that. You can find more information in our release document and readme :)

sovdeeth commented 3 months ago

related? #6830

APickledWalrus commented 3 months ago

Likely. There are probably mainly places that do not properly check ItemMeta/Stack nullability

itfoldy commented 3 months ago

Can any of you build this version and link it as a .jar, so we don't have to do it ourselves, thank you

APickledWalrus commented 3 months ago

Can any of you build this version and link it as a .jar, so we don't have to do it ourselves, thank you

This is automatically done 🙂 You can download the nightly build artifact from here: https://github.com/SkriptLang/Skript/actions/runs/9702144977

sovdeeth commented 3 months ago

The exp orb merge regression test is failing in a novel way, which seems unrelated to the changes here. Perhaps Paper 1.21 doesn't merge xp as aggressively?

TheBentoBox commented 3 months ago

FYI @sovdeeth regarding this:

The exp orb merge regression test is failing in a novel way, which seems unrelated to the changes here. Perhaps Paper 1.21 doesn't merge xp as aggressively?

The defaults were reduced in a recent Paper commit here.

I've used this branch in my 1.21 testing with no issues so far -- thanks/great work team!

sovdeeth commented 3 months ago

FYI @sovdeeth regarding this:

The exp orb merge regression test is failing in a novel way, which seems unrelated to the changes here. Perhaps Paper 1.21 doesn't merge xp as aggressively?

The defaults were reduced in a recent Paper commit here.

I've used this branch in my 1.21 testing with no issues so far -- thanks/great work team!

yeah, we (I) couldn't figure out how to edit the configs in the test servers so i just disabled it for now.