3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-26 00:00:33 +01: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 @Override
@Nullable @Nullable
protected Mappings loadFromObject(JsonObject oldMappings, JsonObject newMappings, @Nullable JsonObject diffMappings, String key) { 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 // Look for custom mappings
super.handleItemToClient(item); super.handleItemToClient(item);
// No custom mapping found, look at VV mappings // Handle one-way special case
if (item.getIdentifier() == originalId) { if (item.getIdentifier() == -1) {
int oldId = protocol.getMappingData().getItemMappings().get(item.getIdentifier()); if (originalId == 362) { // base/colorless shulker box
if (oldId != -1) {
rawId = itemIdToRaw(oldId, item, tag);
} else if (item.getIdentifier() == 362) { // base/colorless shulker box
rawId = 0xe50000; // purple shulker box rawId = 0xe50000; // purple shulker box
} else { } else {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) { 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(); int identifier = item.getIdentifier();
item.setIdentifier(rawId); item.setIdentifier(rawId);
super.handleItemToServer(item); super.handleItemToServer(item);
// Mapped with original data, we can return here // 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 // Set to legacy id again
item.setIdentifier(identifier); item.setIdentifier(identifier);