Fix itemexchange

This commit is contained in:
okx-code
2024-08-18 16:57:30 +01:00
parent f986e92904
commit 0ca93df6cb
2 changed files with 2 additions and 2 deletions

View File

@@ -83,7 +83,7 @@ public record BulkExchangeRule(List<ExchangeRule> rules) implements ExchangeData
return null;
}
final CustomData itemNBT = ItemUtils.getNMSItemStack(item).get(DataComponents.CUSTOM_DATA);
if (itemNBT.copyTag().contains(BULK_KEY)) {
if (itemNBT != null && itemNBT.copyTag().contains(BULK_KEY)) {
var t = new NBTCompound(itemNBT.copyTag());
final var rulesNBT = t.getCompound(BULK_KEY).getCompoundArray(RULES_KEY);

View File

@@ -461,7 +461,7 @@ public final class ExchangeRule implements ExchangeData {
return null;
}
final CustomData itemNBT = ItemUtils.getNMSItemStack(item).get(DataComponents.CUSTOM_DATA);
if (itemNBT.copyTag().contains(RULE_KEY)) {
if (itemNBT != null && itemNBT.copyTag().contains(RULE_KEY)) {
return fromNBT(new NBTCompound((CompoundTag) itemNBT.copyTag().get(RULE_KEY)));
}
return null;