Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-27 08:30:10 +01:00
Allow platforms to disable dummy enchantment in LegacyEnchantmentRewriter (#710)
Dieser Commit ist enthalten in:
Ursprung
0aacfe3bcb
Commit
75fddd0fb9
@ -36,10 +36,17 @@ public class LegacyEnchantmentRewriter {
|
|||||||
|
|
||||||
private final Map<Short, String> enchantmentMappings = new HashMap<>();
|
private final Map<Short, String> enchantmentMappings = new HashMap<>();
|
||||||
private final String nbtTagName;
|
private final String nbtTagName;
|
||||||
|
private final boolean dummyEnchantment;
|
||||||
|
|
||||||
private Set<Short> hideLevelForEnchants;
|
private Set<Short> hideLevelForEnchants;
|
||||||
|
|
||||||
public LegacyEnchantmentRewriter(String nbtTagName) {
|
public LegacyEnchantmentRewriter(String nbtTagName) {
|
||||||
|
this(nbtTagName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LegacyEnchantmentRewriter(String nbtTagName, boolean dummyEnchantment) {
|
||||||
this.nbtTagName = nbtTagName;
|
this.nbtTagName = nbtTagName;
|
||||||
|
this.dummyEnchantment = dummyEnchantment;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerEnchantment(int id, String replacementLore) {
|
public void registerEnchantment(int id, String replacementLore) {
|
||||||
@ -94,12 +101,12 @@ public class LegacyEnchantmentRewriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!lore.isEmpty()) {
|
if (!lore.isEmpty()) {
|
||||||
if (!storedEnchant && enchantments.isEmpty()) {
|
if (this.dummyEnchantment && !storedEnchant && enchantments.isEmpty()) {
|
||||||
CompoundTag dummyEnchantment = new CompoundTag();
|
CompoundTag dummyEnchantment = new CompoundTag();
|
||||||
dummyEnchantment.putShort("id", (short) 0);
|
dummyEnchantment.putShort("id", (short) 0);
|
||||||
dummyEnchantment.putShort("lvl", (short) 0);
|
dummyEnchantment.putShort("lvl", (short) 0);
|
||||||
enchantments.add(dummyEnchantment);
|
|
||||||
|
|
||||||
|
enchantments.add(dummyEnchantment);
|
||||||
tag.put(nbtTagName + "|dummyEnchant", new ByteTag());
|
tag.put(nbtTagName + "|dummyEnchant", new ByteTag());
|
||||||
|
|
||||||
NumberTag hideFlags = tag.getNumberTag("HideFlags");
|
NumberTag hideFlags = tag.getNumberTag("HideFlags");
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren