Slimefun-Addon-Community / Supreme

An addon for slimefun
GNU General Public License v3.0
6 stars 21 forks source link

fix: paper 1.21 compatibility #63

Closed ybw0014 closed 1 month ago

ybw0014 commented 3 months ago

Although sf official version doesnt support 1.21 yet, it is worth applying this PR before getting lots of issues reported when sf supports 1.21. Our forked Slimefun has been updated to 1.21, and there are exceptions thrown in the console when opening certain item's recipe in the guide.

Paper delegates ItemStack in 1.21 (https://github.com/PaperMC/Paper/pull/10852). When you want to create an ItemStack by passing an extended ItemStack instance (e.g. SlimefunItemStack) to the constructor, like this:

new ItemStack(SupremeCetrus.CETRUS_IGNIS)

It will throw exception when you later trying to add this new ItemStack to the inventory in ChestMenu,

I noticed that all the occurrences of new ItemStack(Supreme*) appear in the recipe; it is unnecessary to pass them to a new ItemStack; instead, pass the SlimefunItemStack to the recipe array directly. This PR removes the unnecessary wraps so that they will not cause issues on 1.21 paper servers.

RelativoBR commented 3 months ago

@ybw0014 Two questions:

  1. Is this change compatible with previous versions of slimefun?
  2. Would it be necessary to update the spigot-api dependency?
ybw0014 commented 3 months ago

@ybw0014 Two questions:

  1. Is this change compatible with previous versions of slimefun?
  2. Would it be necessary to update the spigot-api dependency?

Remove the wrapping ItemStack wont hurt anything. basically nothing changed, as the inner SlimefunItemStack is already an ItemStack.

RelativoBR commented 1 month ago

The suggestion was accepted and approved. Closing this PR, as the complete adjustment being made in another PR will be applied to all related occurrences.