--- 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 STREAM_CODEC = new StreamCodec() { public DataComponentPatch decode(RegistryFriendlyByteBuf registryfriendlybytebuf) { @@ -144,7 +144,7 @@ } private static void encodeComponent(RegistryFriendlyByteBuf registryfriendlybytebuf, DataComponentType 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 DataComponentPatch.a set(DataComponentType datacomponenttype, T t0) { this.map.put(datacomponenttype, Optional.of(t0)); return this;