Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Original license: GPL-3.0-only
Original project: https://github.com/Lumine1909/Leaves_Fork

diff --git a/net/minecraft/core/component/PatchedDataComponentMap.java b/net/minecraft/core/component/PatchedDataComponentMap.java
index b0967af2a3f85dad242ec7475ec9d4f7d7badfc7..a41e358035655236f4539a9fb2e5e1aff99cecb8 100644
index b0967af2a3f85dad242ec7475ec9d4f7d7badfc7..d685efdb9241e2d82b5a270444d140646d2f4f3b 100644
--- a/net/minecraft/core/component/PatchedDataComponentMap.java
+++ b/net/minecraft/core/component/PatchedDataComponentMap.java
@@ -18,6 +18,7 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
Expand All @@ -20,31 +20,37 @@ index b0967af2a3f85dad242ec7475ec9d4f7d7badfc7..a41e358035655236f4539a9fb2e5e1af
private net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber<PatchedDataComponentMap> subscriber; // Leaf - Lithium - equipment tracking

public PatchedDataComponentMap(final DataComponentMap prototype) {
@@ -30,6 +31,7 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
@@ -30,6 +31,13 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
this.prototype = prototype;
this.patch = patch;
this.copyOnWrite = copyOnWrite;
+ this.detectMaxStackSizeChange(null); // Leaves - cache item max stack size
+ // Leaves start - cache item max stack size
+ if (!prototype.isEmpty() || !patch.isEmpty()) {
+ detectMaxStackSizeChange(null);
+ } else {
+ this.maxStackSize = 1;
+ }
+ // Leaves end - cache item max stack size
}

public static PatchedDataComponentMap fromPatch(final DataComponentMap prototype, final DataComponentPatch patch) {
@@ -77,6 +79,7 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
@@ -77,6 +85,7 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
lastValue = (Optional<T>)this.patch.put(type, Optional.ofNullable(value));
}

+ this.detectMaxStackSizeChange(type); // Leaves - cache item max stack size
return lastValue != null ? lastValue.orElse(defaultValue) : defaultValue;
}

@@ -94,6 +97,7 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
@@ -94,6 +103,7 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
lastValue = (Optional<? extends T>)this.patch.remove(type);
}

+ this.detectMaxStackSizeChange(type); // Leaves - cache item max stack size
return (T)(lastValue != null ? lastValue.orElse(null) : defaultValue);
}

@@ -118,17 +122,20 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
@@ -118,17 +128,20 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
} else {
this.patch.remove(type);
}
Expand All @@ -65,7 +71,7 @@ index b0967af2a3f85dad242ec7475ec9d4f7d7badfc7..a41e358035655236f4539a9fb2e5e1af
}

public void setAll(final DataComponentMap components) {
@@ -266,4 +273,16 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
@@ -266,4 +279,16 @@ public final class PatchedDataComponentMap implements DataComponentMap, net.caff
public String toString() {
return "{" + this.stream().map(TypedDataComponent::toString).collect(Collectors.joining(", ")) + "}";
}
Expand Down