Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-12-27 08:30:12 +01:00
Fix NPE for unknown enchantments/enchantments not in bedrock
Dieser Commit ist enthalten in:
Ursprung
6f7ad4b569
Commit
59b2805a4a
@ -58,8 +58,10 @@ public class EnchantmentTranslator extends NbtItemStackTranslator {
|
|||||||
if (!(tag instanceof CompoundTag)) continue;
|
if (!(tag instanceof CompoundTag)) continue;
|
||||||
|
|
||||||
CompoundTag bedrockTag = remapEnchantment((CompoundTag) tag);
|
CompoundTag bedrockTag = remapEnchantment((CompoundTag) tag);
|
||||||
bedrockTag.put(new ShortTag("GeyserStoredEnchantment", (short) 0));
|
if (bedrockTag != null) {
|
||||||
newTags.add(bedrockTag);
|
bedrockTag.put(new ShortTag("GeyserStoredEnchantment", (short) 0));
|
||||||
|
newTags.add(bedrockTag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
itemTag.remove("StoredEnchantments");
|
itemTag.remove("StoredEnchantments");
|
||||||
}
|
}
|
||||||
@ -117,11 +119,11 @@ public class EnchantmentTranslator extends NbtItemStackTranslator {
|
|||||||
|
|
||||||
|
|
||||||
private CompoundTag remapEnchantment(CompoundTag tag) {
|
private CompoundTag remapEnchantment(CompoundTag tag) {
|
||||||
Tag javaEnchLvl = ((CompoundTag) tag).get("lvl");
|
Tag javaEnchLvl = tag.get("lvl");
|
||||||
if (!(javaEnchLvl instanceof ShortTag))
|
if (!(javaEnchLvl instanceof ShortTag))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
Tag javaEnchId = ((CompoundTag) tag).get("id");
|
Tag javaEnchId = tag.get("id");
|
||||||
if (!(javaEnchId instanceof StringTag))
|
if (!(javaEnchId instanceof StringTag))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren