mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-30 08:06:01 +00:00
Create 0023-Reset-large-tags.patch
This commit is contained in:
parent
b9c09dbfcb
commit
625be35102
54
patches/server/0023-Reset-large-tags.patch
Normal file
54
patches/server/0023-Reset-large-tags.patch
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Telesphoreo <me@telesphoreo.me>
|
||||||
|
Date: Sat, 11 Jun 2022 23:16:06 -0500
|
||||||
|
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 6b3cfc19c4fd1382ddf534265a1114995a4f6b55..6c0ea385df617793aafe995bcf1264ce9b764297 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;
|
||||||
|
@@ -251,6 +252,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) Registry.ITEM.get(new ResourceLocation(nbttagcompound.getString("id")));
|
||||||
|
this.count = nbttagcompound.getByte("Count");
|
||||||
|
if (nbttagcompound.contains("tag", 10)) {
|
||||||
|
@@ -507,7 +514,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;
|
||||||
|
@@ -839,6 +850,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()) {
|
Loading…
Reference in New Issue
Block a user