3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-25 15:50:12 +01:00

Readd warnings for missing mappings

Dieser Commit ist enthalten in:
KennyTV 2020-09-04 11:06:39 +02:00
Ursprung 897e9545c2
Commit 91b81ebb24
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 33 neuen und 15 gelöschten Zeilen

Datei anzeigen

@ -84,11 +84,35 @@ public class BackwardsMappings extends MappingData {
return VBMappingDataLoader.loadFromDataDir("mapping-" + newVersion + "to" + oldVersion + ".json");
}
/**
* To be overridden.
*/
protected void loadVBExtras(JsonObject oldMappings, JsonObject newMappings) {
}
protected boolean shouldWarnOnMissing(String key) {
return !key.equals("blocks") && !key.equals("statistics");
}
protected void loadVBExtras(JsonObject oldMappings, JsonObject newMappings) {
/**
* @see #getMappedItem(int) for custom backwards mappings
*/
@Override
public int getNewItemId(int id) {
// Don't warn on missing here
return this.itemMappings.get(id);
}
@Override
public int getNewBlockId(int id) {
// Don't warn on missing here
return this.blockMappings.getNewId(id);
}
@Override
public int getOldItemId(final int id) {
// Warn on missing
return checkValidity(id, this.itemMappings.inverse().get(id), "item");
}
@Nullable
@ -101,11 +125,6 @@ public class BackwardsMappings extends MappingData {
return backwardsSoundMappings != null ? backwardsSoundMappings.get(id) : null;
}
@Override
protected int checkValidity(int id, String type) {
return id;
}
@Nullable
public Int2ObjectMap<MappedItem> getBackwardsItemMappings() {
return backwardsItemMappings;

Datei anzeigen

@ -25,9 +25,8 @@ public abstract class ItemRewriter<T extends BackwardsProtocol> extends ItemRewr
public Item handleItemToClient(Item item) {
if (item == null) return null;
CompoundTag display = null;
if (translatableRewriter != null
&& item.getTag() != null && (display = item.getTag().get("display")) != null) {
CompoundTag display = item.getTag() != null ? item.getTag().get("display") : null;
if (translatableRewriter != null && display != null) {
// Handle name and lore components
StringTag name = display.get("Name");
if (name != null) {

Datei anzeigen

@ -84,12 +84,6 @@ 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) {
@ -103,6 +97,12 @@ public class BackwardsMappings extends nl.matsv.viabackwards.api.data.BackwardsM
}
}
@Override
protected int checkValidity(int id, int mappedId, String type) {
// Don't warn for missing ids here
return mappedId;
}
public Int2ObjectMap<String> getStatisticMappings() {
return statisticMappings;
}