mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-27 15:00:13 +01:00
First attempt
This commit is contained in:
parent
344088ae5b
commit
92ef45d166
2 changed files with 14 additions and 24 deletions
|
@ -1,33 +1,24 @@
|
|||
--- a/net/minecraft/core/component/DataComponentPatch.java
|
||||
+++ b/net/minecraft/core/component/DataComponentPatch.java
|
||||
@@ -61,7 +61,7 @@
|
||||
}
|
||||
@@ -125,7 +_,13 @@
|
||||
}
|
||||
|
||||
- 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,13 @@
|
||||
}
|
||||
|
||||
private static <T> void encodeComponent(RegistryFriendlyByteBuf buf, DataComponentType<T> type, Object value) {
|
||||
- type.streamCodec().encode(buf, value);
|
||||
private static <T> void encodeComponent(RegistryFriendlyByteBuf buffer, DataComponentType<T> component, Object value) {
|
||||
- component.streamCodec().encode(buffer, (T)value);
|
||||
+ // Paper start - codec errors of random anonymous classes are useless
|
||||
+ try {
|
||||
+ type.streamCodec().encode(buf, (T) value); // CraftBukkit - decompile error
|
||||
+ component.streamCodec().encode(buffer, (T) value); // CraftBukkit - decompile error
|
||||
+ } catch (final Exception e) {
|
||||
+ throw new RuntimeException("Error encoding component " + type, e);
|
||||
+ throw new RuntimeException("Error encoding component " + component, e);
|
||||
+ }
|
||||
+ // Paper end - codec errors of random anonymous classes are useless
|
||||
}
|
||||
};
|
||||
private static final String REMOVED_PREFIX = "!";
|
||||
@@ -270,7 +276,43 @@
|
||||
private final Reference2ObjectMap<DataComponentType<?>, Optional<?>> map = new Reference2ObjectArrayMap();
|
||||
@@ -230,6 +_,42 @@
|
||||
|
||||
Builder() {}
|
||||
Builder() {
|
||||
}
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public void copy(DataComponentPatch orig) {
|
||||
|
@ -45,7 +36,7 @@
|
|||
+ public boolean isEmpty() {
|
||||
+ return this.map.isEmpty();
|
||||
+ }
|
||||
|
||||
+
|
||||
+ @Override
|
||||
+ public boolean equals(Object object) {
|
||||
+ if (this == object) {
|
||||
|
@ -64,7 +55,6 @@
|
|||
+ return this.map.hashCode();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
public <T> DataComponentPatch.Builder set(DataComponentType<T> type, T value) {
|
||||
this.map.put(type, Optional.of(value));
|
||||
return this;
|
||||
|
||||
public <T> DataComponentPatch.Builder set(DataComponentType<T> component, T value) {
|
||||
this.map.put(component, Optional.of(value));
|
|
@ -1,6 +1,6 @@
|
|||
--- a/net/minecraft/core/component/DataComponents.java
|
||||
+++ b/net/minecraft/core/component/DataComponents.java
|
||||
@@ -180,10 +180,10 @@
|
||||
@@ -180,10 +_,10 @@
|
||||
"map_post_processing", builder -> builder.networkSynchronized(MapPostProcessing.STREAM_CODEC)
|
||||
);
|
||||
public static final DataComponentType<ChargedProjectiles> CHARGED_PROJECTILES = register(
|
||||
|
@ -13,7 +13,7 @@
|
|||
);
|
||||
public static final DataComponentType<PotionContents> POTION_CONTENTS = register(
|
||||
"potion_contents", builder -> builder.persistent(PotionContents.CODEC).networkSynchronized(PotionContents.STREAM_CODEC).cacheEncoding()
|
||||
@@ -250,7 +250,7 @@
|
||||
@@ -250,7 +_,7 @@
|
||||
"pot_decorations", builder -> builder.persistent(PotDecorations.CODEC).networkSynchronized(PotDecorations.STREAM_CODEC).cacheEncoding()
|
||||
);
|
||||
public static final DataComponentType<ItemContainerContents> CONTAINER = register(
|
Loading…
Reference in a new issue