Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-27 08:30:10 +01:00
Remove more unnecessary map lookups
Dieser Commit ist enthalten in:
Ursprung
5988ab4c19
Commit
cf5e5590ad
@ -111,9 +111,7 @@ public class EnchantmentRewriter {
|
|||||||
enchantments = new ListTag(key, CompoundTag.class);
|
enchantments = new ListTag(key, CompoundTag.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!storedEnchant && tag.contains(nbtTagName + "|dummyEnchant")) {
|
if (!storedEnchant && tag.remove(nbtTagName + "|dummyEnchant") != null) {
|
||||||
tag.remove(nbtTagName + "|dummyEnchant");
|
|
||||||
|
|
||||||
for (Tag enchantment : enchantments.clone()) {
|
for (Tag enchantment : enchantments.clone()) {
|
||||||
String id = (String) ((CompoundTag) enchantment).get("id").getValue();
|
String id = (String) ((CompoundTag) enchantment).get("id").getValue();
|
||||||
if (id.isEmpty()) {
|
if (id.isEmpty()) {
|
||||||
|
@ -91,10 +91,9 @@ public class LegacyEnchantmentRewriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IntTag hideFlags = tag.get(nbtTagName + "|oldHideFlags");
|
IntTag hideFlags = tag.remove(nbtTagName + "|oldHideFlags");
|
||||||
if (hideFlags != null) {
|
if (hideFlags != null) {
|
||||||
tag.put(new IntTag("HideFlags", hideFlags.getValue()));
|
tag.put(new IntTag("HideFlags", hideFlags.getValue()));
|
||||||
tag.remove(nbtTagName + "|oldHideFlags");
|
|
||||||
} else {
|
} else {
|
||||||
tag.remove("HideFlags");
|
tag.remove("HideFlags");
|
||||||
}
|
}
|
||||||
|
@ -547,15 +547,11 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
CompoundTag tag = item.getTag();
|
CompoundTag tag = item.getTag();
|
||||||
|
|
||||||
// Use tag to get original ID and data
|
// Use tag to get original ID and data
|
||||||
if (tag != null) {
|
Tag originalIdTag;
|
||||||
// Check for valid tag
|
if (tag != null && (originalIdTag = tag.remove(extraNbtTag)) != null) {
|
||||||
if (tag.get(extraNbtTag) instanceof IntTag) {
|
rawId = (Integer) originalIdTag.getValue();
|
||||||
rawId = (Integer) tag.get(extraNbtTag).getValue();
|
|
||||||
// Remove the tag
|
|
||||||
tag.remove(extraNbtTag);
|
|
||||||
gotRawIdFromTag = true;
|
gotRawIdFromTag = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (rawId == null) {
|
if (rawId == null) {
|
||||||
// Look for custom mappings
|
// Look for custom mappings
|
||||||
@ -947,12 +943,11 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
newEnchantments.add(enchantmentEntry);
|
newEnchantments.add(enchantmentEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTag noMapped = tag.get(extraNbtTag + "|Enchantments");
|
ListTag noMapped = tag.remove(extraNbtTag + "|Enchantments");
|
||||||
if (noMapped != null) {
|
if (noMapped != null) {
|
||||||
for (Tag value : noMapped) {
|
for (Tag value : noMapped) {
|
||||||
newEnchantments.add(value);
|
newEnchantments.add(value);
|
||||||
}
|
}
|
||||||
tag.remove(extraNbtTag + "|Enchantments");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag display = tag.get("display");
|
CompoundTag display = tag.get("display");
|
||||||
@ -960,7 +955,7 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
tag.put(display = new CompoundTag("display"));
|
tag.put(display = new CompoundTag("display"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ListTag oldLore = tag.get(extraNbtTag + "|OldLore");
|
ListTag oldLore = tag.remove(extraNbtTag + "|OldLore");
|
||||||
if (oldLore != null) {
|
if (oldLore != null) {
|
||||||
ListTag lore = display.get("Lore");
|
ListTag lore = display.get("Lore");
|
||||||
if (lore == null) {
|
if (lore == null) {
|
||||||
@ -968,7 +963,6 @@ public class BlockItemPackets1_13 extends nl.matsv.viabackwards.api.rewriters.It
|
|||||||
}
|
}
|
||||||
|
|
||||||
lore.setValue(oldLore.getValue());
|
lore.setValue(oldLore.getValue());
|
||||||
tag.remove(extraNbtTag + "|OldLore");
|
|
||||||
} else if (tag.remove(extraNbtTag + "|DummyLore") != null) {
|
} else if (tag.remove(extraNbtTag + "|DummyLore") != null) {
|
||||||
display.remove("Lore");
|
display.remove("Lore");
|
||||||
if (display.isEmpty()) {
|
if (display.isEmpty()) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren