Skip to content

Commit

Permalink
Fix data accessing code for Keys.LORE
Browse files Browse the repository at this point in the history
  • Loading branch information
Lignium authored and Zidane committed Aug 28, 2021
1 parent 60c3021 commit 2e90bc9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.spongepowered.api.util.weighted.ChanceTable;
import org.spongepowered.api.util.weighted.NestedTableEntry;
import org.spongepowered.api.util.weighted.WeightedTable;
import org.spongepowered.common.SpongeCommon;
import org.spongepowered.common.accessor.world.item.DiggerItemAccessor;
import org.spongepowered.common.adventure.SpongeAdventure;
import org.spongepowered.common.data.provider.DataProviderRegistrator;
Expand Down Expand Up @@ -155,11 +156,11 @@ public static void register(final DataProviderRegistrator registrator) {
.create(Keys.LORE)
.get(h -> {
final CompoundTag tag = h.getTag();
if (tag == null || tag.contains(Constants.Item.ITEM_DISPLAY)) {
if (tag == null || !tag.contains(Constants.Item.ITEM_DISPLAY)) {
return null;
}

final ListTag list = tag.getList(Constants.Item.ITEM_LORE, Constants.NBT.TAG_STRING);
final CompoundTag displayCompound = tag.getCompound(Constants.Item.ITEM_DISPLAY);
final ListTag list = displayCompound.getList(Constants.Item.ITEM_LORE, Constants.NBT.TAG_STRING);
return list.isEmpty() ? null : SpongeAdventure.json(list.stream().collect(NBTCollectors.toStringList()));
})
.set((h, v) -> {
Expand Down

0 comments on commit 2e90bc9

Please sign in to comment.