38 lines
2.3 KiB
Diff
38 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Cryptite <cryptite@gmail.com>
|
|
Date: Sat, 6 May 2023 18:14:26 -0500
|
|
Subject: [PATCH] Maybe can't tostring?
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
|
index e464ada187fd1f15efef29a0e5033aeb0c688059..b2e800c653ba423e40de734218a8e4a020069076 100644
|
|
--- a/src/main/java/net/minecraft/nbt/CompoundTag.java
|
|
+++ b/src/main/java/net/minecraft/nbt/CompoundTag.java
|
|
@@ -507,6 +507,9 @@ public class CompoundTag implements Tag {
|
|
@Override
|
|
public CompoundTag copy() {
|
|
// Paper start - reduce memory footprint of NBTTagCompound
|
|
+ if (this.tags.size() < 0) {
|
|
+ net.minecraft.server.MinecraftServer.LOGGER.debug("Tried to copy an invalid item with negative tags: {}, {}, {}, {}", this.tags, this.tags.getClass().getName());
|
|
+ }
|
|
it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<String, Tag> ret = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(this.tags.size(), 0.8f);
|
|
java.util.Iterator<java.util.Map.Entry<String, Tag>> iterator = (this.tags instanceof it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap) ? ((it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap)this.tags).object2ObjectEntrySet().fastIterator() : this.tags.entrySet().iterator();
|
|
while (iterator.hasNext()) {
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index 625a852db818d95365ad7ae56e6b1de541bbdada..f721dd923711d65338820642dfca89ab8022e9a5 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -765,7 +765,11 @@ public final class ItemStack {
|
|
|
|
itemstack.setPopTime(this.getPopTime());
|
|
if (this.tag != null) {
|
|
- itemstack.tag = this.tag.copy();
|
|
+ if (this.tag.tags.size() < 0) {
|
|
+ ItemStack.LOGGER.debug("Tried to copy an invalid item with negative tags: {}, {}, {}, {}", this.tag, this.tag.tags, this.tag.tags.getClass().getName());
|
|
+ } else {
|
|
+ itemstack.tag = this.tag.copy();
|
|
+ }
|
|
}
|
|
|
|
return itemstack;
|