3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 08:30:09 +01:00
Dieser Commit ist enthalten in:
creeper123123321 2018-07-20 15:54:52 -03:00
Ursprung 32161333dd
Commit 9a1376dcb3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 0AC57D54786721D1

Datei anzeigen

@ -315,7 +315,7 @@ public class InventoryPackets {
for (Tag enchEntry : ench) { for (Tag enchEntry : ench) {
if (enchEntry instanceof CompoundTag) { if (enchEntry instanceof CompoundTag) {
CompoundTag enchantmentEntry = new CompoundTag(""); CompoundTag enchantmentEntry = new CompoundTag("");
short oldId = (short) ((CompoundTag) enchEntry).get("id").getValue(); short oldId = ((Number) ((CompoundTag) enchEntry).get("id").getValue()).shortValue();
String newId = MappingData.oldEnchantmentsIds.get(oldId); String newId = MappingData.oldEnchantmentsIds.get(oldId);
if (newId == null){ if (newId == null){
newId = "viaversion:legacy/"+oldId; newId = "viaversion:legacy/"+oldId;
@ -334,7 +334,7 @@ public class InventoryPackets {
for (Tag enchEntry : storedEnch) { for (Tag enchEntry : storedEnch) {
if (enchEntry instanceof CompoundTag) { if (enchEntry instanceof CompoundTag) {
CompoundTag enchantmentEntry = new CompoundTag(""); CompoundTag enchantmentEntry = new CompoundTag("");
short oldId = (short) ((CompoundTag) enchEntry).get("id").getValue(); short oldId = ((Number) ((CompoundTag) enchEntry).get("id").getValue()).shortValue();
String newId = MappingData.oldEnchantmentsIds.get(oldId); String newId = MappingData.oldEnchantmentsIds.get(oldId);
if (newId == null) { if (newId == null) {
newId = "viaversion:legacy/"+oldId; newId = "viaversion:legacy/"+oldId;
@ -522,13 +522,15 @@ public class InventoryPackets {
ListTag newStoredEnch = new ListTag("StoredEnchantments", CompoundTag.class); ListTag newStoredEnch = new ListTag("StoredEnchantments", CompoundTag.class);
for (Tag enchantmentEntry : storedEnch) { for (Tag enchantmentEntry : storedEnch) {
if (enchantmentEntry instanceof CompoundTag) { if (enchantmentEntry instanceof CompoundTag) {
CompoundTag enchEntry = new CompoundTag(""); CompoundTag enchEntry = new CompoundTag("");String newId = (String) ((CompoundTag) enchantmentEntry).get("id").getValue();
Short oldId = MappingData.oldEnchantmentsIds.inverse().get(newId);
if (oldId == null && newId.startsWith("viaversion:legacy/")){
oldId = Short.valueOf(newId.substring(18));
}
enchEntry.put( enchEntry.put(
new ShortTag( new ShortTag(
"id", "id",
MappingData.oldEnchantmentsIds.inverse().get( oldId
(String) ((CompoundTag) enchantmentEntry).get("id").getValue()
)
) )
); );
enchEntry.put(new ShortTag("lvl", (Short) ((CompoundTag) enchantmentEntry).get("lvl").getValue())); enchEntry.put(new ShortTag("lvl", (Short) ((CompoundTag) enchantmentEntry).get("lvl").getValue()));