Skip to content

Commit

Permalink
修复1.21部分菜单物品无法显示
Browse files Browse the repository at this point in the history
采用CustomItemStack修复1.21菜单物品无法显示,修复在其他附属某些条件下SlimefunItemStack类型无法转换CraftItemStack问题。
  • Loading branch information
LobbyTech-MC authored Nov 12, 2024
1 parent 6664da3 commit 3feeb45
Showing 1 changed file with 4 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import city.norain.slimefun4.holder.SlimefunInventoryHolder;
import io.github.thebusybiscuit.slimefun4.api.items.SlimefunItemStack;
import io.github.bakedlibs.dough.items.CustomItemStack;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
Expand Down Expand Up @@ -131,15 +132,9 @@ public ChestMenu addItem(int slot, ItemStack item) {
// do shallow copy due to Paper ItemStack system change
// See also: https://github.com/PaperMC/Paper/pull/10852
ItemStack actual = item;
if (item instanceof SlimefunItemStack) {
ItemStack clone = new ItemStack(item.getType(), item.getAmount());

if (item.hasItemMeta()) {
clone.setItemMeta(item.getItemMeta());
}

actual = clone;
}
if (item != null) {
actual = new CustomItemStack(item);
}

setSize((int) (Math.max(getSize(), Math.ceil((slot + 1) / 9d) * 9)));

Expand Down

0 comments on commit 3feeb45

Please sign in to comment.