3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 00:22:53 +01:00

Merge branch 'master' into dev

# Conflicts:
#	gradle.properties
#	gradle/libs.versions.toml
Dieser Commit ist enthalten in:
Nassim Jahnke 2024-03-07 13:49:23 +01:00
Commit 6ad1dc4195
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
33 geänderte Dateien mit 150 neuen und 194 gelöschten Zeilen

2
.github/FUNDING.yml vendored Normale Datei
Datei anzeigen

@ -0,0 +1,2 @@
github: kennytv
patreon: kennytv

Datei anzeigen

@ -21,11 +21,11 @@ body:
attributes: attributes:
label: Console Error label: Console Error
description: | description: |
If you encounter warnings/errors in your console, **paste them with https://paste.gg/ and put the paste link here**. If you encounter warnings/errors in your console, **paste them with https://mclo.gs/ and put the paste link here**.
If the error is small/less than 10 lines, you may put it directly into this field. If the error is small/less than 10 lines, you may put it directly into this field.
value: | value: |
``` ```
Put the paste.gg link or text here. Put the mclo.gs link or text here.
``` ```
placeholder: Please do not remove the grave accents; simply replace the line of text in the middle. placeholder: Please do not remove the grave accents; simply replace the line of text in the middle.
validations: validations:

Datei anzeigen

@ -6,7 +6,7 @@ plugins {
allprojects { allprojects {
group = "com.viaversion" group = "com.viaversion"
version = property("projectVersion") as String // from gradle.properties version = property("projectVersion") as String // from gradle.properties
description = "Allow older clients to join newer server versions." description = "Allows older Minecraft client versions to connect to newer server versions."
} }
val main = setOf( val main = setOf(

Datei anzeigen

@ -1,6 +1,6 @@
name: ViaBackwards name: ViaBackwards
version: ${version} version: ${version}
description: Allow older Minecraft versions to connect to a newer server version. description: ${description}
main: com.viaversion.viabackwards.BukkitPlugin main: com.viaversion.viabackwards.BukkitPlugin
api-version: 1.13 api-version: 1.13
folia-supported: true folia-supported: true

Datei anzeigen

@ -78,13 +78,13 @@ public class EnchantmentRewriter {
public void rewriteEnchantmentsToClient(CompoundTag tag, boolean storedEnchant) { public void rewriteEnchantmentsToClient(CompoundTag tag, boolean storedEnchant) {
String key = storedEnchant ? "StoredEnchantments" : "Enchantments"; String key = storedEnchant ? "StoredEnchantments" : "Enchantments";
ListTag enchantments = tag.getListTag(key); ListTag<CompoundTag> enchantments = tag.getListTag(key, CompoundTag.class);
List<Tag> loreToAdd = new ArrayList<>(); List<StringTag> loreToAdd = new ArrayList<>();
boolean changed = false; boolean changed = false;
Iterator<Tag> iterator = enchantments.iterator(); Iterator<CompoundTag> iterator = enchantments.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
CompoundTag enchantmentEntry = (CompoundTag) iterator.next(); CompoundTag enchantmentEntry = iterator.next();
StringTag idTag = enchantmentEntry.getStringTag("id"); StringTag idTag = enchantmentEntry.getStringTag("id");
String enchantmentId = idTag.getValue(); String enchantmentId = idTag.getValue();
@ -123,9 +123,9 @@ public class EnchantmentRewriter {
tag.put("display", display = new CompoundTag()); tag.put("display", display = new CompoundTag());
} }
ListTag loreTag = display.getListTag("Lore"); ListTag<StringTag> loreTag = display.getListTag("Lore", StringTag.class);
if (loreTag == null) { if (loreTag == null) {
display.put("Lore", loreTag = new ListTag(StringTag.class)); display.put("Lore", loreTag = new ListTag<>(StringTag.class));
} else { } else {
// Save original lore // Save original lore
itemRewriter.saveListTag(display, loreTag, "Lore"); itemRewriter.saveListTag(display, loreTag, "Lore");

Datei anzeigen

@ -64,15 +64,10 @@ public class ItemRewriter<C extends ClientboundPacketType, S extends Serverbound
name.setValue(newValue); name.setValue(newValue);
} }
ListTag lore = display.getListTag("Lore"); ListTag<StringTag> lore = display.getListTag("Lore", StringTag.class);
if (lore != null) { if (lore != null) {
boolean changed = false; boolean changed = false;
for (Tag loreEntryTag : lore) { for (StringTag loreEntry : lore) {
if (!(loreEntryTag instanceof StringTag)) {
continue;
}
StringTag loreEntry = (StringTag) loreEntryTag;
String newValue = protocol.getTranslatableRewriter().processText(loreEntry.getValue()).toString(); String newValue = protocol.getTranslatableRewriter().processText(loreEntry.getValue()).toString();
if (!changed && !newValue.equals(loreEntry.getValue())) { if (!changed && !newValue.equals(loreEntry.getValue())) {
// Backup original lore before doing any modifications // Backup original lore before doing any modifications

Datei anzeigen

@ -66,17 +66,11 @@ public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extend
} }
} }
protected void saveListTag(CompoundTag displayTag, ListTag original, String name) { protected void saveListTag(CompoundTag displayTag, ListTag<?> original, String name) {
// Multiple places might try to backup data // Multiple places might try to backup data
String backupName = nbtTagName + "|o" + name; String backupName = nbtTagName + "|o" + name;
if (!displayTag.contains(backupName)) { if (!displayTag.contains(backupName)) {
// Clone all tag entries displayTag.put(backupName, original.copy());
ListTag listTag = new ListTag();
for (Tag tag : original.getValue()) {
listTag.add(tag.copy());
}
displayTag.put(backupName, listTag);
} }
} }
@ -107,7 +101,7 @@ public abstract class ItemRewriterBase<C extends ClientboundPacketType, S extend
protected void restoreListTag(CompoundTag tag, String tagName) { protected void restoreListTag(CompoundTag tag, String tagName) {
Tag original = tag.remove(nbtTagName + "|o" + tagName); Tag original = tag.remove(nbtTagName + "|o" + tagName);
if (original instanceof ListTag) { if (original instanceof ListTag) {
tag.put(tagName, new ListTag(((ListTag) original).getValue())); tag.put(tagName, ((ListTag<?>) original).copy());
} }
} }

Datei anzeigen

@ -47,23 +47,18 @@ public class LegacyEnchantmentRewriter {
public void rewriteEnchantmentsToClient(CompoundTag tag, boolean storedEnchant) { public void rewriteEnchantmentsToClient(CompoundTag tag, boolean storedEnchant) {
String key = storedEnchant ? "StoredEnchantments" : "ench"; String key = storedEnchant ? "StoredEnchantments" : "ench";
ListTag enchantments = tag.getListTag(key); ListTag<CompoundTag> enchantments = tag.getListTag(key, CompoundTag.class);
ListTag remappedEnchantments = new ListTag(CompoundTag.class); ListTag<CompoundTag> remappedEnchantments = new ListTag<>(CompoundTag.class);
List<Tag> lore = new ArrayList<>(); List<StringTag> lore = new ArrayList<>();
for (Tag enchantmentEntry : enchantments.copy()) { for (CompoundTag enchantmentEntry : enchantments.copy()) {
if (!(enchantmentEntry instanceof CompoundTag)) { NumberTag idTag = enchantmentEntry.getNumberTag("id");
continue;
}
CompoundTag entryTag = (CompoundTag) enchantmentEntry;
NumberTag idTag = entryTag.getNumberTag("id");
if (idTag == null) continue; if (idTag == null) continue;
short newId = idTag.asShort(); short newId = idTag.asShort();
String enchantmentName = enchantmentMappings.get(newId); String enchantmentName = enchantmentMappings.get(newId);
if (enchantmentName != null) { if (enchantmentName != null) {
enchantments.remove(enchantmentEntry); enchantments.remove(enchantmentEntry);
NumberTag levelTag = entryTag.getNumberTag("lvl"); NumberTag levelTag = enchantmentEntry.getNumberTag("lvl");
short level = levelTag != null ? levelTag.asShort() : 1; short level = levelTag != null ? levelTag.asShort() : 1;
if (hideLevelForEnchants != null && hideLevelForEnchants.contains(newId)) { if (hideLevelForEnchants != null && hideLevelForEnchants.contains(newId)) {
lore.add(new StringTag(enchantmentName)); lore.add(new StringTag(enchantmentName));
@ -99,9 +94,9 @@ public class LegacyEnchantmentRewriter {
if (display == null) { if (display == null) {
tag.put("display", display = new CompoundTag()); tag.put("display", display = new CompoundTag());
} }
ListTag loreTag = display.getListTag("Lore"); ListTag<StringTag> loreTag = display.getListTag("Lore", StringTag.class);
if (loreTag == null) { if (loreTag == null) {
display.put("Lore", loreTag = new ListTag(StringTag.class)); display.put("Lore", loreTag = new ListTag<>(StringTag.class));
} }
lore.addAll(loreTag.getValue()); lore.addAll(loreTag.getValue());
@ -111,21 +106,15 @@ public class LegacyEnchantmentRewriter {
public void rewriteEnchantmentsToServer(CompoundTag tag, boolean storedEnchant) { public void rewriteEnchantmentsToServer(CompoundTag tag, boolean storedEnchant) {
String key = storedEnchant ? "StoredEnchantments" : "ench"; String key = storedEnchant ? "StoredEnchantments" : "ench";
ListTag remappedEnchantments = tag.remove(nbtTagName + "|" + key); ListTag<CompoundTag> enchantments = tag.getListTag(key, CompoundTag.class);
ListTag enchantments = tag.getListTag(key);
if (enchantments == null) { if (enchantments == null) {
enchantments = new ListTag(CompoundTag.class); enchantments = new ListTag<>(CompoundTag.class);
} }
if (!storedEnchant && tag.remove(nbtTagName + "|dummyEnchant") != null) { if (!storedEnchant && tag.remove(nbtTagName + "|dummyEnchant") != null) {
for (Tag enchantment : enchantments.copy()) { for (CompoundTag enchantment : enchantments.copy()) {
if (!(enchantment instanceof CompoundTag)) { NumberTag idTag = enchantment.getNumberTag("id");
continue; NumberTag levelTag = enchantment.getNumberTag("lvl");
}
CompoundTag entryTag = (CompoundTag) enchantment;
NumberTag idTag = entryTag.getNumberTag("id");
NumberTag levelTag = entryTag.getNumberTag("lvl");
short id = idTag != null ? idTag.asShort() : 0; short id = idTag != null ? idTag.asShort() : 0;
short level = levelTag != null ? levelTag.asShort() : 0; short level = levelTag != null ? levelTag.asShort() : 0;
if (id == 0 && level == 0) { if (id == 0 && level == 0) {
@ -143,8 +132,9 @@ public class LegacyEnchantmentRewriter {
CompoundTag display = tag.getCompoundTag("display"); CompoundTag display = tag.getCompoundTag("display");
// A few null checks just to be safe, though they shouldn't actually be // A few null checks just to be safe, though they shouldn't actually be
ListTag lore = display != null ? display.getListTag("Lore") : null; ListTag<StringTag> lore = display != null ? display.getListTag("Lore", StringTag.class) : null;
for (Tag enchantment : remappedEnchantments.copy()) { ListTag<CompoundTag> remappedEnchantments = tag.remove(nbtTagName + "|" + key);
for (CompoundTag enchantment : remappedEnchantments.copy()) {
enchantments.add(enchantment); enchantments.add(enchantment);
if (lore != null && !lore.isEmpty()) { if (lore != null && !lore.isEmpty()) {
lore.remove(lore.get(0)); lore.remove(lore.get(0));

Datei anzeigen

@ -115,7 +115,7 @@ public class BlockItemPackets1_11 extends LegacyBlockItemRewriter<ClientboundPac
map(Type.STRING); // 0 - Channel map(Type.STRING); // 0 - Channel
handler(wrapper -> { handler(wrapper -> {
if (wrapper.get(Type.STRING, 0).equalsIgnoreCase("MC|TrList")) { if (wrapper.get(Type.STRING, 0).equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID wrapper.passthrough(Type.INT); // Passthrough Window ID
int size = wrapper.passthrough(Type.UNSIGNED_BYTE); int size = wrapper.passthrough(Type.UNSIGNED_BYTE);

Datei anzeigen

@ -91,7 +91,7 @@ public class BlockItemPackets1_12 extends LegacyBlockItemRewriter<ClientboundPac
map(Type.STRING); // 0 - Channel map(Type.STRING); // 0 - Channel
handler(wrapper -> { handler(wrapper -> {
if (wrapper.get(Type.STRING, 0).equalsIgnoreCase("MC|TrList")) { if (wrapper.get(Type.STRING, 0).equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID wrapper.passthrough(Type.INT); // Passthrough Window ID
int size = wrapper.passthrough(Type.UNSIGNED_BYTE); int size = wrapper.passthrough(Type.UNSIGNED_BYTE);

Datei anzeigen

@ -49,7 +49,7 @@ public class ItemPackets1_11_1 extends LegacyBlockItemRewriter<ClientboundPacket
map(Type.STRING); // 0 - Channel map(Type.STRING); // 0 - Channel
handler(wrapper -> { handler(wrapper -> {
if (wrapper.get(Type.STRING, 0).equalsIgnoreCase("MC|TrList")) { if (wrapper.get(Type.STRING, 0).equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID wrapper.passthrough(Type.INT); // Passthrough Window ID
int size = wrapper.passthrough(Type.UNSIGNED_BYTE); int size = wrapper.passthrough(Type.UNSIGNED_BYTE);

Datei anzeigen

@ -48,14 +48,11 @@ public class BannerHandler implements BackwardsBlockEntityHandler {
} }
// Invert colors // Invert colors
ListTag patternsTag = tag.getListTag("Patterns"); ListTag<CompoundTag> patternsTag = tag.getListTag("Patterns", CompoundTag.class);
if (patternsTag != null) { if (patternsTag != null) {
for (Tag pattern : patternsTag) { for (CompoundTag pattern : patternsTag) {
if (!(pattern instanceof CompoundTag)) continue; NumberTag colorTag = pattern.getNumberTag("Color");
pattern.putInt("Color", 15 - colorTag.asInt()); // Invert color id
CompoundTag patternTag = (CompoundTag) pattern;
NumberTag colorTag = patternTag.getNumberTag("Color");
patternTag.putInt("Color", 15 - colorTag.asInt()); // Invert color id
} }
} }

Datei anzeigen

@ -47,7 +47,7 @@ public class PistonHandler implements BackwardsBlockEntityProvider.BackwardsBloc
addEntries(entry.getKey(), entry.getValue()); addEntries(entry.getKey(), entry.getValue());
} }
} else { } else {
ListTag blockStates = MappingDataLoader.loadNBT("blockstates-1.13.nbt").get("blockstates"); ListTag<StringTag> blockStates = MappingDataLoader.loadNBT("blockstates-1.13.nbt").getListTag("blockstates", StringTag.class);
for (int id = 0; id < blockStates.size(); id++) { for (int id = 0; id < blockStates.size(); id++) {
StringTag state = blockStates.get(id); StringTag state = blockStates.get(id);
String key = state.getValue(); String key = state.getValue();

Datei anzeigen

@ -602,10 +602,10 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
private void rewriteCanPlaceToClient(CompoundTag tag, String tagName) { private void rewriteCanPlaceToClient(CompoundTag tag, String tagName) {
// The tag was manually created incorrectly so ignore rewriting it // The tag was manually created incorrectly so ignore rewriting it
ListTag blockTag = tag.getListTag(tagName); ListTag<?> blockTag = tag.getListTag(tagName);
if (blockTag == null) return; if (blockTag == null) return;
ListTag newCanPlaceOn = new ListTag(StringTag.class); ListTag<StringTag> newCanPlaceOn = new ListTag<>(StringTag.class);
tag.put(extraNbtTag + "|" + tagName, blockTag.copy()); tag.put(extraNbtTag + "|" + tagName, blockTag.copy());
for (Tag oldTag : blockTag) { for (Tag oldTag : blockTag) {
Object value = oldTag.getValue(); Object value = oldTag.getValue();
@ -616,7 +616,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
newCanPlaceOn.add(new StringTag(newValue)); newCanPlaceOn.add(new StringTag(newValue));
} }
} else { } else {
newCanPlaceOn.add(oldTag); newCanPlaceOn.add(new StringTag(oldTag.getValue().toString()));
} }
} }
tag.put(tagName, newCanPlaceOn); tag.put(tagName, newCanPlaceOn);
@ -625,19 +625,14 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
//TODO un-ugly all of this //TODO un-ugly all of this
private void rewriteEnchantmentsToClient(CompoundTag tag, boolean storedEnch) { private void rewriteEnchantmentsToClient(CompoundTag tag, boolean storedEnch) {
String key = storedEnch ? "StoredEnchantments" : "Enchantments"; String key = storedEnch ? "StoredEnchantments" : "Enchantments";
ListTag enchantments = tag.getListTag(key); ListTag<CompoundTag> enchantments = tag.getListTag(key, CompoundTag.class);
if (enchantments == null) return; if (enchantments == null) return;
ListTag noMapped = new ListTag(CompoundTag.class); ListTag<CompoundTag> noMapped = new ListTag<>(CompoundTag.class);
ListTag newEnchantments = new ListTag(CompoundTag.class); ListTag<CompoundTag> newEnchantments = new ListTag<>(CompoundTag.class);
List<Tag> lore = new ArrayList<>(); List<StringTag> lore = new ArrayList<>();
boolean hasValidEnchants = false; boolean hasValidEnchants = false;
for (Tag enchantmentEntryTag : enchantments.copy()) { for (CompoundTag enchantmentEntry : enchantments.copy()) {
if (!(enchantmentEntryTag instanceof CompoundTag)) {
continue;
}
CompoundTag enchantmentEntry = (CompoundTag) enchantmentEntryTag;
StringTag idTag = enchantmentEntry.getStringTag("id"); StringTag idTag = enchantmentEntry.getStringTag("id");
if (idTag == null) { if (idTag == null) {
continue; continue;
@ -725,13 +720,13 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
tag.put("display", display = new CompoundTag()); tag.put("display", display = new CompoundTag());
} }
ListTag loreTag = display.getListTag("Lore"); ListTag<StringTag> loreTag = display.getListTag("Lore", StringTag.class);
if (loreTag == null) { if (loreTag == null) {
display.put("Lore", loreTag = new ListTag(StringTag.class)); display.put("Lore", loreTag = new ListTag<>(StringTag.class));
tag.put(extraNbtTag + "|DummyLore", new ByteTag()); tag.put(extraNbtTag + "|DummyLore", new ByteTag());
} else if (!loreTag.isEmpty()) { } else if (!loreTag.isEmpty()) {
ListTag oldLore = new ListTag(StringTag.class); ListTag<StringTag> oldLore = new ListTag<>(StringTag.class);
for (Tag value : loreTag) { for (StringTag value : loreTag) {
oldLore.add(value.copy()); oldLore.add(value.copy());
} }
tag.put(extraNbtTag + "|OldLore", oldLore); tag.put(extraNbtTag + "|OldLore", oldLore);
@ -859,11 +854,11 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
private void rewriteCanPlaceToServer(CompoundTag tag, String tagName) { private void rewriteCanPlaceToServer(CompoundTag tag, String tagName) {
if (tag.getListTag(tagName) == null) return; if (tag.getListTag(tagName) == null) return;
ListTag blockTag = tag.remove(extraNbtTag + "|" + tagName); ListTag<?> blockTag = tag.remove(extraNbtTag + "|" + tagName);
if (blockTag != null) { if (blockTag != null) {
tag.put(tagName, blockTag.copy()); tag.put(tagName, blockTag.copy());
} else if ((blockTag = tag.getListTag(tagName)) != null) { } else if ((blockTag = tag.getListTag(tagName)) != null) {
ListTag newCanPlaceOn = new ListTag(StringTag.class); ListTag<StringTag> newCanPlaceOn = new ListTag<>(StringTag.class);
for (Tag oldTag : blockTag) { for (Tag oldTag : blockTag) {
Object value = oldTag.getValue(); Object value = oldTag.getValue();
String oldId = Key.stripMinecraftNamespace(value.toString()); String oldId = Key.stripMinecraftNamespace(value.toString());
@ -889,10 +884,10 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
private void rewriteEnchantmentsToServer(CompoundTag tag, boolean storedEnch) { private void rewriteEnchantmentsToServer(CompoundTag tag, boolean storedEnch) {
String key = storedEnch ? "StoredEnchantments" : "Enchantments"; String key = storedEnch ? "StoredEnchantments" : "Enchantments";
ListTag enchantments = tag.getListTag(storedEnch ? key : "ench"); ListTag<CompoundTag> enchantments = tag.getListTag(storedEnch ? key : "ench", CompoundTag.class);
if (enchantments == null) return; if (enchantments == null) return;
ListTag newEnchantments = new ListTag(CompoundTag.class); ListTag<CompoundTag> newEnchantments = new ListTag<>(CompoundTag.class);
boolean dummyEnchant = false; boolean dummyEnchant = false;
if (!storedEnch) { if (!storedEnch) {
Tag hideFlags = tag.remove(extraNbtTag + "|OldHideFlags"); Tag hideFlags = tag.remove(extraNbtTag + "|OldHideFlags");
@ -905,12 +900,7 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
} }
} }
for (Tag enchEntry : enchantments) { for (CompoundTag entryTag : enchantments) {
if (!(enchEntry instanceof CompoundTag)) {
continue;
}
CompoundTag entryTag = (CompoundTag) enchEntry;
NumberTag idTag = entryTag.getNumberTag("id"); NumberTag idTag = entryTag.getNumberTag("id");
NumberTag levelTag = entryTag.getNumberTag("lvl"); NumberTag levelTag = entryTag.getNumberTag("lvl");
CompoundTag enchantmentEntry = new CompoundTag(); CompoundTag enchantmentEntry = new CompoundTag();
@ -930,11 +920,12 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
newEnchantments.add(enchantmentEntry); newEnchantments.add(enchantmentEntry);
} }
Tag noMapped = tag.remove(extraNbtTag + "|Enchantments"); ListTag<CompoundTag> noMapped = tag.getListTag(extraNbtTag + "|Enchantments", CompoundTag.class);
if (noMapped instanceof ListTag) { if (noMapped != null) {
for (Tag value : ((ListTag) noMapped)) { for (CompoundTag value : noMapped) {
newEnchantments.add(value); newEnchantments.add(value);
} }
tag.remove(extraNbtTag + "|Enchantments");
} }
CompoundTag display = tag.getCompoundTag("display"); CompoundTag display = tag.getCompoundTag("display");
@ -942,14 +933,15 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
tag.put("display", display = new CompoundTag()); tag.put("display", display = new CompoundTag());
} }
Tag oldLore = tag.remove(extraNbtTag + "|OldLore"); ListTag<StringTag> oldLore = tag.getListTag(extraNbtTag + "|OldLore", StringTag.class);
if (oldLore instanceof ListTag) { if (oldLore != null) {
ListTag lore = display.getListTag("Lore"); ListTag<StringTag> lore = display.getListTag("Lore", StringTag.class);
if (lore == null) { if (lore == null) {
tag.put("Lore", lore = new ListTag()); tag.put("Lore", lore = new ListTag<>(StringTag.class));
} }
lore.setValue(((ListTag) 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()) {
@ -974,14 +966,11 @@ public class BlockItemPackets1_13 extends com.viaversion.viabackwards.api.rewrit
blockEntityTag.putInt("Base", 15 - base.asInt()); // Invert color id blockEntityTag.putInt("Base", 15 - base.asInt()); // Invert color id
} }
ListTag patterns = blockEntityTag.getListTag("Patterns"); ListTag<CompoundTag> patterns = blockEntityTag.getListTag("Patterns", CompoundTag.class);
if (patterns != null) { if (patterns != null) {
for (Tag pattern : patterns) { for (CompoundTag pattern : patterns) {
if (!(pattern instanceof CompoundTag)) continue; NumberTag colorTag = pattern.getNumberTag("Color");
pattern.putInt("Color", 15 - colorTag.asInt()); // Invert color id
CompoundTag patternTag = (CompoundTag) pattern;
NumberTag colorTag = patternTag.getNumberTag("Color");
patternTag.putInt("Color", 15 - colorTag.asInt()); // Invert color id
} }
} }
} }

Datei anzeigen

@ -473,17 +473,14 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit
CompoundTag tag = item.tag(); CompoundTag tag = item.tag();
CompoundTag display; CompoundTag display;
if (tag != null && (display = tag.getCompoundTag("display")) != null) { if (tag != null && (display = tag.getCompoundTag("display")) != null) {
ListTag lore = display.getListTag("Lore"); ListTag<StringTag> lore = display.getListTag("Lore", StringTag.class);
if (lore != null) { if (lore != null) {
saveListTag(display, lore, "Lore"); saveListTag(display, lore, "Lore");
for (Tag loreEntry : lore) { for (StringTag loreEntry : lore) {
if (!(loreEntry instanceof StringTag)) continue; String value = loreEntry.getValue();
StringTag loreEntryTag = (StringTag) loreEntry;
String value = loreEntryTag.getValue();
if (value != null && !value.isEmpty()) { if (value != null && !value.isEmpty()) {
loreEntryTag.setValue(ComponentUtil.jsonToLegacy(value)); loreEntry.setValue(ComponentUtil.jsonToLegacy(value));
} }
} }
} }
@ -502,13 +499,10 @@ public class BlockItemPackets1_14 extends com.viaversion.viabackwards.api.rewrit
CompoundTag display; CompoundTag display;
if (tag != null && (display = tag.getCompoundTag("display")) != null) { if (tag != null && (display = tag.getCompoundTag("display")) != null) {
// Transform to json if no backup tag is found (else process that in the super method) // Transform to json if no backup tag is found (else process that in the super method)
ListTag lore = display.getListTag("Lore"); ListTag<StringTag> lore = display.getListTag("Lore", StringTag.class);
if (lore != null && !hasBackupTag(display, "Lore")) { if (lore != null && !hasBackupTag(display, "Lore")) {
for (Tag loreEntry : lore) { for (StringTag loreEntry : lore) {
if (loreEntry instanceof StringTag) { loreEntry.setValue(ComponentUtil.legacyToJsonString(loreEntry.getValue()));
StringTag loreEntryTag = (StringTag) loreEntry;
loreEntryTag.setValue(ComponentUtil.legacyToJsonString(loreEntryTag.getValue()));
}
} }
} }
} }

Datei anzeigen

@ -309,16 +309,11 @@ public class BlockItemPackets1_16 extends com.viaversion.viabackwards.api.rewrit
// Handle hover event changes in written book pages // Handle hover event changes in written book pages
if (item.identifier() == 759 && tag != null) { if (item.identifier() == 759 && tag != null) {
ListTag pagesTag = tag.getListTag("pages"); ListTag<StringTag> pagesTag = tag.getListTag("pages", StringTag.class);
if (pagesTag != null) { if (pagesTag != null) {
for (Tag page : pagesTag) { for (StringTag page : pagesTag) {
if (!(page instanceof StringTag)) { JsonElement jsonElement = protocol.getTranslatableRewriter().processText(page.getValue());
continue; page.setValue(jsonElement.toString());
}
StringTag pageTag = (StringTag) page;
JsonElement jsonElement = protocol.getTranslatableRewriter().processText(pageTag.getValue());
pageTag.setValue(jsonElement.toString());
} }
} }
} }

Datei anzeigen

@ -149,7 +149,7 @@ public class BlockItemPackets1_16_2 extends com.viaversion.viabackwards.api.rewr
CompoundTag properties = skullOwnerTag.getCompoundTag("Properties"); CompoundTag properties = skullOwnerTag.getCompoundTag("Properties");
if (properties == null) return; if (properties == null) return;
ListTag textures = properties.getListTag("textures"); ListTag<CompoundTag> textures = properties.getListTag("textures", CompoundTag.class);
if (textures == null) return; if (textures == null) return;
CompoundTag first = !textures.isEmpty() ? textures.get(0) : null; CompoundTag first = !textures.isEmpty() ? textures.get(0) : null;

Datei anzeigen

@ -76,13 +76,12 @@ public class EntityPackets1_16_2 extends EntityRewriter<ClientboundPackets1_16_2
if (wrapper.user().getProtocolInfo().protocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) { if (wrapper.user().getProtocolInfo().protocolVersion().olderThanOrEqualTo(ProtocolVersion.v1_15_2)) {
// Store biomes for <1.16 client handling // Store biomes for <1.16 client handling
CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome"); CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
ListTag biomes = biomeRegistry.get("value"); ListTag<CompoundTag> biomes = biomeRegistry.getListTag("value", CompoundTag.class);
BiomeStorage biomeStorage = wrapper.user().get(BiomeStorage.class); BiomeStorage biomeStorage = wrapper.user().get(BiomeStorage.class);
biomeStorage.clear(); biomeStorage.clear();
for (Tag biome : biomes) { for (CompoundTag biome : biomes) {
CompoundTag biomeCompound = (CompoundTag) biome; StringTag name = biome.get("name");
StringTag name = biomeCompound.get("name"); NumberTag id = biome.get("id");
NumberTag id = biomeCompound.get("id");
biomeStorage.addBiome(name.getValue(), id.asInt()); biomeStorage.addBiome(name.getValue(), id.asInt());
} }
} else if (!warned) { } else if (!warned) {

Datei anzeigen

@ -81,9 +81,9 @@ public final class EntityPackets1_17 extends EntityRewriter<ClientboundPackets1_
handler(wrapper -> { handler(wrapper -> {
CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome"); CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
ListTag biomes = biomeRegistry.get("value"); ListTag<CompoundTag> biomes = biomeRegistry.getListTag("value", CompoundTag.class);
for (Tag biome : biomes) { for (CompoundTag biome : biomes) {
CompoundTag biomeCompound = ((CompoundTag) biome).get("element"); CompoundTag biomeCompound = biome.get("element");
StringTag category = biomeCompound.get("category"); StringTag category = biomeCompound.get("category");
if (category.getValue().equalsIgnoreCase("underground")) { if (category.getValue().equalsIgnoreCase("underground")) {
category.setValue("none"); category.setValue("none");
@ -91,9 +91,9 @@ public final class EntityPackets1_17 extends EntityRewriter<ClientboundPackets1_
} }
CompoundTag dimensionRegistry = registry.get("minecraft:dimension_type"); CompoundTag dimensionRegistry = registry.get("minecraft:dimension_type");
ListTag dimensions = dimensionRegistry.get("value"); ListTag<CompoundTag> dimensions = dimensionRegistry.getListTag("value", CompoundTag.class);
for (Tag dimension : dimensions) { for (CompoundTag dimension : dimensions) {
CompoundTag dimensionCompound = ((CompoundTag) dimension).get("element"); CompoundTag dimensionCompound = dimension.get("element");
reduceExtendedHeight(dimensionCompound, false); reduceExtendedHeight(dimensionCompound, false);
} }

Datei anzeigen

@ -62,9 +62,9 @@ public final class EntityPackets1_18 extends EntityRewriter<ClientboundPackets1_
handler(wrapper -> { handler(wrapper -> {
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome"); final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
final ListTag biomes = biomeRegistry.get("value"); final ListTag<CompoundTag> biomes = biomeRegistry.getListTag("value", CompoundTag.class);
for (final Tag biome : biomes.getValue()) { for (final CompoundTag biome : biomes) {
final CompoundTag biomeCompound = ((CompoundTag) biome).get("element"); final CompoundTag biomeCompound = biome.get("element");
final StringTag category = biomeCompound.get("category"); final StringTag category = biomeCompound.get("category");
if (category.getValue().equals("mountain")) { if (category.getValue().equals("mountain")) {
category.setValue("extreme_hills"); category.setValue("extreme_hills");

Datei anzeigen

@ -102,10 +102,10 @@ public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPac
wrapper.passthrough(Type.VAR_INT); // Slot comes first wrapper.passthrough(Type.VAR_INT); // Slot comes first
CompoundTag tag = item.tag(); CompoundTag tag = item.tag();
ListTag pagesTag; ListTag<StringTag> pagesTag;
StringTag titleTag = null; StringTag titleTag = null;
// Sanity checks // Sanity checks
if (tag == null || (pagesTag = tag.getListTag("pages")) == null if (tag == null || (pagesTag = tag.getListTag("pages", StringTag.class)) == null
|| (signing && (titleTag = tag.getStringTag("title")) == null)) { || (signing && (titleTag = tag.getStringTag("title")) == null)) {
wrapper.write(Type.VAR_INT, 0); // Pages length wrapper.write(Type.VAR_INT, 0); // Pages length
wrapper.write(Type.BOOLEAN, false); // Optional title wrapper.write(Type.BOOLEAN, false); // Optional title
@ -114,12 +114,12 @@ public final class Protocol1_17To1_17_1 extends BackwardsProtocol<ClientboundPac
// Write pages - limit them first // Write pages - limit them first
if (pagesTag.size() > MAX_PAGES) { if (pagesTag.size() > MAX_PAGES) {
pagesTag = new ListTag(pagesTag.getValue().subList(0, MAX_PAGES)); pagesTag = new ListTag<>(pagesTag.getValue().subList(0, MAX_PAGES));
} }
wrapper.write(Type.VAR_INT, pagesTag.size()); wrapper.write(Type.VAR_INT, pagesTag.size());
for (Tag pageTag : pagesTag) { for (StringTag pageTag : pagesTag) {
String page = ((StringTag) pageTag).getValue(); String page = pageTag.getValue();
// Limit page length // Limit page length
if (page.length() > MAX_PAGE_LENGTH) { if (page.length() > MAX_PAGE_LENGTH) {
page = page.substring(0, MAX_PAGE_LENGTH); page = page.substring(0, MAX_PAGE_LENGTH);

Datei anzeigen

@ -23,7 +23,6 @@ import com.viaversion.viaversion.libs.fastutil.ints.Int2ObjectOpenHashMap;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.CompoundTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.ListTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.NumberTag; import com.viaversion.viaversion.libs.opennbt.tag.builtin.NumberTag;
import com.viaversion.viaversion.libs.opennbt.tag.builtin.Tag;
import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2; import com.viaversion.viaversion.protocols.protocol1_19to1_18_2.Protocol1_19To1_18_2;
import org.checkerframework.checker.nullness.qual.Nullable; import org.checkerframework.checker.nullness.qual.Nullable;
@ -39,11 +38,10 @@ public final class BackwardsMappings extends com.viaversion.viabackwards.api.dat
protected void loadExtras(final CompoundTag data) { protected void loadExtras(final CompoundTag data) {
super.loadExtras(data); super.loadExtras(data);
final ListTag chatTypes = VBMappingDataLoader.loadNBT("chat-types-1.19.1.nbt").get("values"); final ListTag<CompoundTag> chatTypes = VBMappingDataLoader.loadNBT("chat-types-1.19.1.nbt").getListTag("values", CompoundTag.class);
for (final Tag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {
final CompoundTag chatTypeCompound = (CompoundTag) chatType; final NumberTag idTag = chatType.get("id");
final NumberTag idTag = chatTypeCompound.get("id"); defaultChatTypes.put(idTag.asInt(), chatType);
defaultChatTypes.put(idTag.asInt(), chatTypeCompound);
} }
} }

Datei anzeigen

@ -131,12 +131,11 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
// Cache dimensions and find current dimension // Cache dimensions and find current dimension
final String dimensionKey = wrapper.read(Type.STRING); final String dimensionKey = wrapper.read(Type.STRING);
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final ListTag dimensions = ((CompoundTag) registry.get("minecraft:dimension_type")).get("value"); final ListTag<CompoundTag> dimensions = ((CompoundTag) registry.get("minecraft:dimension_type")).getListTag("value", CompoundTag.class);
boolean found = false; boolean found = false;
for (final Tag dimension : dimensions) { for (final CompoundTag dimension : dimensions) {
final CompoundTag dimensionCompound = (CompoundTag) dimension; final StringTag nameTag = dimension.get("name");
final StringTag nameTag = dimensionCompound.get("name"); final CompoundTag dimensionData = dimension.get("element");
final CompoundTag dimensionData = dimensionCompound.get("element");
dimensionRegistryStorage.addDimension(nameTag.getValue(), dimensionData.copy()); dimensionRegistryStorage.addDimension(nameTag.getValue(), dimensionData.copy());
if (!found && nameTag.getValue().equals(dimensionKey)) { if (!found && nameTag.getValue().equals(dimensionKey)) {
@ -150,19 +149,18 @@ public final class EntityPackets1_19 extends EntityRewriter<ClientboundPackets1_
// Add biome category and track biomes // Add biome category and track biomes
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome"); final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
final ListTag biomes = biomeRegistry.get("value"); final ListTag<CompoundTag> biomes = biomeRegistry.getListTag("value", CompoundTag.class);
for (final Tag biome : biomes.getValue()) { for (final CompoundTag biome : biomes.getValue()) {
final CompoundTag biomeCompound = ((CompoundTag) biome).get("element"); final CompoundTag biomeCompound = biome.get("element");
biomeCompound.putString("category", "none"); biomeCompound.putString("category", "none");
} }
tracker(wrapper.user()).setBiomesSent(biomes.size()); tracker(wrapper.user()).setBiomesSent(biomes.size());
// Cache and remove chat types // Cache and remove chat types
final ListTag chatTypes = ((CompoundTag) registry.remove("minecraft:chat_type")).get("value"); final ListTag<CompoundTag> chatTypes = ((CompoundTag) registry.remove("minecraft:chat_type")).getListTag("value", CompoundTag.class);
for (final Tag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {
final CompoundTag chatTypeCompound = (CompoundTag) chatType; final NumberTag idTag = chatType.get("id");
final NumberTag idTag = chatTypeCompound.get("id"); dimensionRegistryStorage.addChatType(idTag.asInt(), chatType);
dimensionRegistryStorage.addChatType(idTag.asInt(), chatTypeCompound);
} }
}); });
map(Type.STRING); // World map(Type.STRING); // World

Datei anzeigen

@ -82,9 +82,9 @@ public final class Protocol1_18To1_18_2 extends BackwardsProtocol<ClientboundPac
handler(wrapper -> { handler(wrapper -> {
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final CompoundTag dimensionsHolder = registry.get("minecraft:dimension_type"); final CompoundTag dimensionsHolder = registry.get("minecraft:dimension_type");
final ListTag dimensions = dimensionsHolder.get("value"); final ListTag<CompoundTag> dimensions = dimensionsHolder.getListTag("value", CompoundTag.class);
for (final Tag dimension : dimensions) { for (final CompoundTag dimension : dimensions) {
removeTagPrefix(((CompoundTag) dimension).get("element")); removeTagPrefix(dimension.get("element"));
} }
removeTagPrefix(wrapper.get(Type.NAMED_COMPOUND_TAG, 1)); removeTagPrefix(wrapper.get(Type.NAMED_COMPOUND_TAG, 1));

Datei anzeigen

@ -82,11 +82,10 @@ public final class EntityPackets1_19_3 extends EntityRewriter<ClientboundPackets
final ChatTypeStorage1_19_3 chatTypeStorage = wrapper.user().get(ChatTypeStorage1_19_3.class); final ChatTypeStorage1_19_3 chatTypeStorage = wrapper.user().get(ChatTypeStorage1_19_3.class);
chatTypeStorage.clear(); chatTypeStorage.clear();
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final ListTag chatTypes = registry.getCompoundTag("minecraft:chat_type").get("value"); final ListTag<CompoundTag> chatTypes = registry.getCompoundTag("minecraft:chat_type").getListTag("value", CompoundTag.class);
for (final Tag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {
final CompoundTag chatTypeCompound = (CompoundTag) chatType; final NumberTag idTag = chatType.get("id");
final NumberTag idTag = chatTypeCompound.get("id"); chatTypeStorage.addChatType(idTag.asInt(), chatType);
chatTypeStorage.addChatType(idTag.asInt(), chatTypeCompound);
} }
}); });
handler(wrapper -> { handler(wrapper -> {

Datei anzeigen

@ -68,9 +68,9 @@ public final class EntityPackets1_19_4 extends EntityRewriter<ClientboundPackets
registry.remove("minecraft:damage_type"); registry.remove("minecraft:damage_type");
final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome"); final CompoundTag biomeRegistry = registry.get("minecraft:worldgen/biome");
final ListTag biomes = biomeRegistry.get("value"); final ListTag<CompoundTag> biomes = biomeRegistry.getListTag("value", CompoundTag.class);
for (final Tag biomeTag : biomes) { for (final CompoundTag biomeTag : biomes) {
final CompoundTag biomeData = ((CompoundTag) biomeTag).get("element"); final CompoundTag biomeData = biomeTag.get("element");
final NumberTag hasPrecipitation = biomeData.get("has_precipitation"); final NumberTag hasPrecipitation = biomeData.get("has_precipitation");
biomeData.putString("precipitation", hasPrecipitation.asByte() == 1 ? "rain" : "none"); biomeData.putString("precipitation", hasPrecipitation.asByte() == 1 ? "rain" : "none");
} }

Datei anzeigen

@ -218,13 +218,13 @@ public final class BlockItemPackets1_20 extends ItemRewriter<ClientboundPackets1
} }
private void writeMessages(final CompoundTag frontText, final CompoundTag tag, final boolean filtered) { private void writeMessages(final CompoundTag frontText, final CompoundTag tag, final boolean filtered) {
final ListTag messages = frontText.getListTag(filtered ? "filtered_messages" : "messages"); final ListTag<StringTag> messages = frontText.getListTag(filtered ? "filtered_messages" : "messages", StringTag.class);
if (messages == null) { if (messages == null) {
return; return;
} }
int i = 0; int i = 0;
for (final Tag message : messages) { for (final StringTag message : messages) {
tag.put((filtered ? "FilteredText" : "Text") + ++i, message); tag.put((filtered ? "FilteredText" : "Text") + ++i, message);
} }

Datei anzeigen

@ -80,20 +80,20 @@ public final class EntityPackets1_20 extends EntityRewriter<ClientboundPackets1_
handler(wrapper -> { handler(wrapper -> {
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final ListTag values; final ListTag<CompoundTag> values;
// A 1.20 server can't send this element, and the 1.20 client still works, if the element is missing // A 1.20 server can't send this element, and the 1.20 client still works, if the element is missing
// on a 1.19.4 client there is an exception, so in case the 1.20 server doesn't send the element we put in an original 1.20 element // on a 1.19.4 client there is an exception, so in case the 1.20 server doesn't send the element we put in an original 1.20 element
final CompoundTag trimPatternTag = registry.getCompoundTag("minecraft:trim_pattern"); final CompoundTag trimPatternTag = registry.getCompoundTag("minecraft:trim_pattern");
if (trimPatternTag != null) { if (trimPatternTag != null) {
values = trimPatternTag.getListTag("value"); values = trimPatternTag.getListTag("value", CompoundTag.class);
} else { } else {
final CompoundTag trimPatternRegistry = Protocol1_19_4To1_20.MAPPINGS.getTrimPatternRegistry().copy(); final CompoundTag trimPatternRegistry = Protocol1_19_4To1_20.MAPPINGS.getTrimPatternRegistry().copy();
registry.put("minecraft:trim_pattern", trimPatternRegistry); registry.put("minecraft:trim_pattern", trimPatternRegistry);
values = trimPatternRegistry.get("value"); values = trimPatternRegistry.get("value");
} }
for (final Tag entry : values) { for (final CompoundTag entry : values) {
final CompoundTag element = ((CompoundTag) entry).get("element"); final CompoundTag element = entry.get("element");
final StringTag templateItem = element.get("template_item"); final StringTag templateItem = element.get("template_item");
if (newTrimPatterns.contains(Key.stripMinecraftNamespace(templateItem.getValue()))) { if (newTrimPatterns.contains(Key.stripMinecraftNamespace(templateItem.getValue()))) {
templateItem.setValue("minecraft:spire_armor_trim_smithing_template"); templateItem.setValue("minecraft:spire_armor_trim_smithing_template");

Datei anzeigen

@ -103,11 +103,10 @@ public final class Protocol1_19To1_19_1 extends BackwardsProtocol<ClientboundPac
chatTypeStorage.clear(); chatTypeStorage.clear();
final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0); final CompoundTag registry = wrapper.get(Type.NAMED_COMPOUND_TAG, 0);
final ListTag chatTypes = registry.getCompoundTag("minecraft:chat_type").get("value"); final ListTag<CompoundTag> chatTypes = registry.getCompoundTag("minecraft:chat_type").getListTag("value", CompoundTag.class);
for (final Tag chatType : chatTypes) { for (final CompoundTag chatType : chatTypes) {
final CompoundTag chatTypeCompound = (CompoundTag) chatType; final NumberTag idTag = chatType.get("id");
final NumberTag idTag = chatTypeCompound.get("id"); chatTypeStorage.addChatType(idTag.asInt(), chatType);
chatTypeStorage.addChatType(idTag.asInt(), chatTypeCompound);
} }
// Replace with 1.19 chat types // Replace with 1.19 chat types

Datei anzeigen

@ -102,7 +102,7 @@ public final class EntityPacketRewriter1_20_5 extends EntityRewriter<Clientbound
// Write to old format // Write to old format
final CompoundTag registryTag = new CompoundTag(); final CompoundTag registryTag = new CompoundTag();
final ListTag entriesTag = new ListTag(); final ListTag<CompoundTag> entriesTag = new ListTag<>(CompoundTag.class);
registryTag.putString("type", registryKey); registryTag.putString("type", registryKey);
registryTag.put("value", entriesTag); registryTag.put("value", entriesTag);
for (int i = 0; i < entries.length; i++) { for (int i = 0; i < entries.length; i++) {

Datei anzeigen

@ -49,7 +49,7 @@ public class BlockItemPackets1_10 extends LegacyBlockItemRewriter<ClientboundPac
map(Type.STRING); // 0 - Channel map(Type.STRING); // 0 - Channel
handler(wrapper -> { handler(wrapper -> {
if (wrapper.get(Type.STRING, 0).equalsIgnoreCase("MC|TrList")) { if (wrapper.get(Type.STRING, 0).equals("MC|TrList")) {
wrapper.passthrough(Type.INT); // Passthrough Window ID wrapper.passthrough(Type.INT); // Passthrough Window ID
int size = wrapper.passthrough(Type.UNSIGNED_BYTE); int size = wrapper.passthrough(Type.UNSIGNED_BYTE);

Datei anzeigen

@ -3,10 +3,10 @@
"id": "viabackwards", "id": "viabackwards",
"name": "ViaBackwards", "name": "ViaBackwards",
"version": "${version}", "version": "${version}",
"description": "Allow older Minecraft versions to connect to a newer server version.", "description": "${description}",
"license": "GPL-3.0", "license": "GPL-3.0",
"contact": { "contact": {
"homepage": "https://github.com/ViaVersion/ViaBackwards", "homepage": "https://viaversion.com/backwards",
"issues": "https://github.com/ViaVersion/ViaBackwards/issues", "issues": "https://github.com/ViaVersion/ViaBackwards/issues",
"sources": "https://github.com/ViaVersion/ViaBackwards" "sources": "https://github.com/ViaVersion/ViaBackwards"
}, },
@ -30,5 +30,12 @@
}, },
"recommends": { "recommends": {
"viarewind": "*" "viarewind": "*"
} },
"custom": {
"modmenu:api": true,
"modmenu": {
"badges": [ "library" ],
"parent": "viafabric"
}
}
} }

Datei anzeigen

@ -37,7 +37,7 @@ import java.util.logging.Logger;
name = "ViaBackwards", name = "ViaBackwards",
version = VersionInfo.VERSION, version = VersionInfo.VERSION,
authors = {"Matsv", "kennytv", "Gerrygames", "creeper123123321", "ForceUpdate1"}, authors = {"Matsv", "kennytv", "Gerrygames", "creeper123123321", "ForceUpdate1"},
description = "Allow older Minecraft versions to connect to a newer server version.", description = "Allows older Minecraft client versions to connect to newer server versions.",
dependencies = {@Dependency(id = "viaversion")} dependencies = {@Dependency(id = "viaversion")}
) )
public class VelocityPlugin implements ViaBackwardsPlatform { public class VelocityPlugin implements ViaBackwardsPlatform {