3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-19 14:30:16 +01:00

Fix item cost type reading

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-04-28 15:15:17 +02:00
Ursprung d068822143
Commit 5f90bcbbaf
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F

Datei anzeigen

@ -22,6 +22,7 @@
*/ */
package com.viaversion.viaversion.api.minecraft.data; package com.viaversion.viaversion.api.minecraft.data;
import com.google.common.base.Preconditions;
import com.viaversion.viaversion.api.Via; import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.FullMappings; import com.viaversion.viaversion.api.data.FullMappings;
import com.viaversion.viaversion.api.protocol.Protocol; import com.viaversion.viaversion.api.protocol.Protocol;
@ -44,7 +45,7 @@ public final class StructuredDataContainer {
public StructuredDataContainer(final StructuredData<?>[] dataArray) { public StructuredDataContainer(final StructuredData<?>[] dataArray) {
this(new Reference2ObjectOpenHashMap<>(dataArray.length)); this(new Reference2ObjectOpenHashMap<>(dataArray.length));
for (final StructuredData<?> data : dataArray) { for (final StructuredData<?> data : dataArray) {
add(data); this.data.put(data.key(), data);
} }
} }
@ -138,6 +139,7 @@ public final class StructuredDataContainer {
*/ */
public void setIdLookup(final Protocol<?, ?, ?, ?> protocol, final boolean mappedNames) { public void setIdLookup(final Protocol<?, ?, ?, ?> protocol, final boolean mappedNames) {
this.lookup = protocol.getMappingData().getDataComponentSerializerMappings(); this.lookup = protocol.getMappingData().getDataComponentSerializerMappings();
Preconditions.checkNotNull(this.lookup, "Data component serializer mappings are null");
this.mappedNames = mappedNames; this.mappedNames = mappedNames;
} }
@ -159,10 +161,6 @@ public final class StructuredDataContainer {
return data; return data;
} }
private <T> void add(final StructuredData<T> data) {
set(data.key(), data.value());
}
@Override @Override
public String toString() { public String toString() {
return "StructuredDataContainer{" + return "StructuredDataContainer{" +