0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/craftbukkit.git synced 2024-11-24 19:16:15 +00:00
craftbukkit/nms-patches/net/minecraft/core/component/DataComponentPatch.patch
2024-06-14 01:05:00 +10:00

64 lines
2.1 KiB
Diff

--- a/net/minecraft/core/component/DataComponentPatch.java
+++ b/net/minecraft/core/component/DataComponentPatch.java
@@ -61,7 +61,7 @@
}
}
- return reference2objectmap;
+ return (Reference2ObjectMap) reference2objectmap; // CraftBukkit - decompile error
});
public static final StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch> STREAM_CODEC = new StreamCodec<RegistryFriendlyByteBuf, DataComponentPatch>() {
public DataComponentPatch decode(RegistryFriendlyByteBuf registryfriendlybytebuf) {
@@ -144,7 +144,7 @@
}
private static <T> void encodeComponent(RegistryFriendlyByteBuf registryfriendlybytebuf, DataComponentType<T> datacomponenttype, Object object) {
- datacomponenttype.streamCodec().encode(registryfriendlybytebuf, object);
+ datacomponenttype.streamCodec().encode(registryfriendlybytebuf, (T) object); // CraftBukkit - decompile error
}
};
private static final String REMOVED_PREFIX = "!";
@@ -271,6 +271,42 @@
a() {}
+ // CraftBukkit start
+ public void copy(DataComponentPatch orig) {
+ this.map.putAll(orig.map);
+ }
+
+ public void clear(DataComponentType<?> type) {
+ this.map.remove(type);
+ }
+
+ public boolean isSet(DataComponentType<?> type) {
+ return map.containsKey(type);
+ }
+
+ public boolean isEmpty() {
+ return this.map.isEmpty();
+ }
+
+ @Override
+ public boolean equals(Object object) {
+ if (this == object) {
+ return true;
+ }
+
+ if (object instanceof DataComponentPatch.a patch) {
+ return this.map.equals(patch.map);
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return this.map.hashCode();
+ }
+ // CraftBukkit end
+
public <T> DataComponentPatch.a set(DataComponentType<T> datacomponenttype, T t0) {
this.map.put(datacomponenttype, Optional.of(t0));
return this;