Fix item cost type reading

This commit is contained in:
Nassim Jahnke 2024-04-28 15:15:17 +02:00
parent d068822143
commit 5f90bcbbaf
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F

View File

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