3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-07-26 00:48:03 +02:00

Fix 1.13<->1.12 special case handling

Dieser Commit ist enthalten in:
KennyTV 2020-09-03 16:47:35 +02:00
Ursprung 947e5c3e07
Commit 897e9545c2
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
2 geänderte Dateien mit 11 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -84,6 +84,12 @@ public class BackwardsMappings extends nl.matsv.viabackwards.api.data.BackwardsM
}
}
@Override
public int getOldItemId(final int id) {
// Return -1 when missing
return this.itemMappings.inverse().get(id);
}
@Override
@Nullable
protected Mappings loadFromObject(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) {

Datei anzeigen

@ -527,12 +527,9 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
// Look for custom mappings
super.handleItemToClient(item);
// No custom mapping found, look at VV mappings
if (item.getIdentifier() == originalId) {
int oldId = protocol.getMappingData().getItemMappings().get(item.getIdentifier());
if (oldId != -1) {
rawId = itemIdToRaw(oldId, item, tag);
} else if (item.getIdentifier() == 362) { // base/colorless shulker box
// Handle one-way special case
if (item.getIdentifier() == -1) {
if (originalId == 362) { // base/colorless shulker box
rawId = 0xe50000; // purple shulker box
} else {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
@ -816,8 +813,9 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
int identifier = item.getIdentifier();
item.setIdentifier(rawId);
super.handleItemToServer(item);
// Mapped with original data, we can return here
if (item.getIdentifier() != rawId) return item;
if (item.getIdentifier() != rawId && item.getIdentifier() != -1) return item;
// Set to legacy id again
item.setIdentifier(identifier);