--- a/net/minecraft/core/component/DataComponentPatch.java +++ b/net/minecraft/core/component/DataComponentPatch.java @@ -60,7 +60,7 @@ } } - return reference2objectmap; + return (Reference2ObjectMap) reference2objectmap; // CraftBukkit - decompile error }); public static final StreamCodec STREAM_CODEC = createStreamCodec(new DataComponentPatch.b() { @Override @@ -159,7 +159,7 @@ } private void encodeComponent(RegistryFriendlyByteBuf registryfriendlybytebuf, DataComponentType datacomponenttype, Object object) { - datacomponentpatch_b.apply(datacomponenttype).encode(registryfriendlybytebuf, object); + datacomponentpatch_b.apply(datacomponenttype).encode(registryfriendlybytebuf, (T) object); // CraftBukkit - decompile error } }; } @@ -321,6 +321,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 DataComponentPatch.a set(DataComponentType datacomponenttype, T t0) { this.map.put(datacomponenttype, Optional.of(t0)); return this;