mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-07-08 01:40:00 +00:00
55 lines
2.3 KiB
Diff
55 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Telesphoreo <me@telesphoreo.me>
|
|
Date: Sat, 10 Dec 2022 23:38:53 -0600
|
|
Subject: [PATCH] Reset large tags
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
index 6860096cb8c0deecc9c1d87543d1128fb95fd2d4..d7b02676c646db61a5351b72c1c929e8dd80795c 100644
|
|
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
|
|
@@ -20,6 +20,7 @@ import java.util.function.Predicate;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Stream;
|
|
import javax.annotation.Nullable;
|
|
+import me.totalfreedom.scissors.NbtUtility;
|
|
import net.minecraft.ChatFormatting;
|
|
import net.minecraft.Util;
|
|
import net.minecraft.advancements.CriteriaTriggers;
|
|
@@ -255,6 +256,12 @@ public final class ItemStack {
|
|
|
|
// CraftBukkit - break into own method
|
|
private void load(CompoundTag nbttagcompound) {
|
|
+ // Scissors start - Reset large tags
|
|
+ if (NbtUtility.isTooLarge(nbttagcompound)) {
|
|
+ // Reset tag without destroying item
|
|
+ nbttagcompound = NbtUtility.Item.removeItemData(nbttagcompound);
|
|
+ }
|
|
+ // Scissors end
|
|
this.item = (Item) BuiltInRegistries.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
|
|
this.count = nbttagcompound.getByte("Count");
|
|
if (nbttagcompound.contains("tag", 10)) {
|
|
@@ -516,7 +523,11 @@ public final class ItemStack {
|
|
nbt.putString("id", minecraftkey == null ? "minecraft:air" : minecraftkey.toString());
|
|
nbt.putByte("Count", (byte) this.count);
|
|
if (this.tag != null) {
|
|
- nbt.put("tag", this.tag.copy());
|
|
+ // Scissors start - Don't save large tags
|
|
+ if (!NbtUtility.isTooLarge(this.tag)) {
|
|
+ nbt.put("tag", this.tag.copy());
|
|
+ }
|
|
+ // Scissors end
|
|
}
|
|
|
|
return nbt;
|
|
@@ -847,6 +858,9 @@ public final class ItemStack {
|
|
// Paper end
|
|
|
|
public void setTag(@Nullable CompoundTag nbt) {
|
|
+ // Scissors start - Ignore large tags
|
|
+ if (NbtUtility.isTooLarge(nbt)) return;
|
|
+ // Scissors end
|
|
this.tag = nbt;
|
|
this.processEnchantOrder(this.tag); // Paper
|
|
if (this.getItem().canBeDepleted()) {
|