Skip to content

Commit

Permalink
add workaround for spigot 1.17 remap error
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Jun 15, 2021
1 parent 2cdac73 commit 431469f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Expand Up @@ -297,10 +297,10 @@ public List<String> getLore(ItemTag item) {
return null;
}
net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(item.getItemStack());
ListTag list = ((net.minecraft.nbt.CompoundTag) nmsItemStack.getTag().get("display")).getList("Lore", 8);
List<net.minecraft.nbt.Tag> list = ((net.minecraft.nbt.CompoundTag) nmsItemStack.getTag().get("display")).getList("Lore", 8);
List<String> outList = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
BaseComponent[] lineComponent = ComponentSerializer.parse(list.getString(i));
BaseComponent[] lineComponent = ComponentSerializer.parse(((ListTag) list).getString(i));
outList.add(FormattedTextHelper.stringify(lineComponent, ChatColor.WHITE));
}
return outList;
Expand Down Expand Up @@ -335,11 +335,11 @@ public void setLore(ItemTag item, List<String> lore) {
display.put("Lore", null);
}
else {
ListTag tagList = new ListTag();
List<net.minecraft.nbt.Tag> tagList = new ListTag();
for (String line : lore) {
tagList.add(net.minecraft.nbt.StringTag.valueOf(ComponentSerializer.toString(FormattedTextHelper.parse(line, ChatColor.WHITE))));
}
display.put("Lore", tagList);
display.put("Lore", (ListTag) tagList);
}
item.setItemStack(CraftItemStack.asBukkitCopy(nmsItemStack));
}
Expand Down
Expand Up @@ -55,15 +55,15 @@ else if (entry.getValue() instanceof IntArrayTag) {
tag.putIntArray(entry.getKey(), ((IntArrayTag) entry.getValue()).getValue());
}
else if (entry.getValue() instanceof JNBTListTag) {
ListTag list = new ListTag();
List<net.minecraft.nbt.Tag> list = new ListTag();
List<Tag> tags = ((JNBTListTag) entry.getValue()).getValue();
for (Tag btag : tags) {
HashMap<String, Tag> btags = new HashMap<>();
btags.put("test", btag);
CompoundTagImpl comp = new CompoundTagImpl(btags);
list.add(comp.toNMSTag().get("test"));
}
tag.put(entry.getKey(), list);
tag.put(entry.getKey(), (ListTag) list);
}
else if (entry.getValue() instanceof LongTag) {
tag.putLong(entry.getKey(), ((LongTag) entry.getValue()).getValue());
Expand Down Expand Up @@ -116,7 +116,7 @@ else if (base instanceof net.minecraft.nbt.StringTag) {
tags.put(key, new StringTag(base.getAsString()));
}
else if (base instanceof ListTag) {
ListTag list = (ListTag) base;
List<net.minecraft.nbt.Tag> list = (List<net.minecraft.nbt.Tag>) base;
if (list.size() > 0) {
net.minecraft.nbt.Tag nbase = list.get(0);
net.minecraft.nbt.CompoundTag comp = new net.minecraft.nbt.CompoundTag();
Expand Down

0 comments on commit 431469f

Please sign in to comment.