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

Fix item mappings with explicit data (0) (#738)

Dieser Commit ist enthalten in:
EnZaXD 2024-05-07 18:54:38 +02:00 committet von GitHub
Ursprung 072b59060c
Commit 7f0982e59c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194

Datei anzeigen

@ -105,7 +105,7 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
unmappedId = Integer.parseInt(key.substring(0, dataSeparatorIndex));
unmappedId = IdAndData.toRawData(unmappedId, unmappedData);
} else {
unmappedId = IdAndData.toRawData(Integer.parseInt(key));
unmappedId = IdAndData.toRawData(Integer.parseInt(key), -1);
}
mappings.put(unmappedId, new MappedLegacyBlockItem(id, data, name, type));
@ -120,12 +120,12 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
// Special block color handling
if (name != null && name.contains("%color%")) {
for (int i = from; i <= to; i++) {
mappings.put(IdAndData.toRawData(i), new MappedLegacyBlockItem(id, data, name.replace("%color%", BlockColors.get(i - from)), type));
mappings.put(IdAndData.toRawData(i, -1), new MappedLegacyBlockItem(id, data, name.replace("%color%", BlockColors.get(i - from)), type));
}
} else {
MappedLegacyBlockItem mappedBlockItem = new MappedLegacyBlockItem(id, data, name, type);
for (int i = from; i <= to; i++) {
mappings.put(IdAndData.toRawData(i), mappedBlockItem);
mappings.put(IdAndData.toRawData(i, -1), mappedBlockItem);
}
}
}
@ -361,17 +361,18 @@ public abstract class LegacyBlockItemRewriter<C extends ClientboundPacketType, S
private @Nullable MappedLegacyBlockItem getMappedBlock(int id, int data) {
MappedLegacyBlockItem mapping = blockReplacements.get(IdAndData.toRawData(id, data));
return mapping != null || data == 0 ? mapping : blockReplacements.get(IdAndData.toRawData(id));
return mapping != null ? mapping : blockReplacements.get(IdAndData.toRawData(id, -1));
}
private @Nullable MappedLegacyBlockItem getMappedItem(int id, int data) {
MappedLegacyBlockItem mapping = itemReplacements.get(IdAndData.toRawData(id, data));
return mapping != null || data == 0 ? mapping : itemReplacements.get(IdAndData.toRawData(id));
return mapping != null ? mapping : itemReplacements.get(IdAndData.toRawData(id, -1));
}
private @Nullable MappedLegacyBlockItem getMappedBlock(int rawId) {
MappedLegacyBlockItem mapping = blockReplacements.get(rawId);
return mapping != null ? mapping : blockReplacements.get(IdAndData.removeData(rawId));
int id = IdAndData.getId(rawId);
int data = IdAndData.getData(rawId);
return getMappedBlock(id, data);
}
protected JsonObject readMappingsFile(final String name) {