Set mappings default values to -1

This commit is contained in:
Nassim Jahnke 2021-11-17 19:52:31 +01:00
parent 71f4012537
commit 888441b81d
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B

View File

@ -21,6 +21,8 @@ import com.viaversion.viaversion.api.data.IntArrayMappings;
import com.viaversion.viaversion.api.data.MappingDataLoader; import com.viaversion.viaversion.api.data.MappingDataLoader;
import com.viaversion.viaversion.api.data.Mappings; import com.viaversion.viaversion.api.data.Mappings;
import java.util.Arrays;
public final class VBMappings extends IntArrayMappings { public final class VBMappings extends IntArrayMappings {
private VBMappings(final int[] oldToNew, final int mappedIds) { private VBMappings(final int[] oldToNew, final int mappedIds) {
@ -42,6 +44,7 @@ public final class VBMappings extends IntArrayMappings {
final int size = this.size != -1 ? this.size : size(unmapped); final int size = this.size != -1 ? this.size : size(unmapped);
final int mappedSize = this.mappedSize != -1 ? this.mappedSize : size(mapped); final int mappedSize = this.mappedSize != -1 ? this.mappedSize : size(mapped);
final int[] mappings = new int[size]; final int[] mappings = new int[size];
Arrays.fill(mappings, -1);
// Do conversion if one is an array and the other an object, otherwise directly map // Do conversion if one is an array and the other an object, otherwise directly map
if (unmapped.isJsonArray()) { if (unmapped.isJsonArray()) {
if (mapped.isJsonObject()) { if (mapped.isJsonObject()) {