3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-27 16:40:10 +01:00

Don't throw an exception on hover parse failure

Dieser Commit ist enthalten in:
KennyTV 2021-04-11 13:35:53 +02:00
Ursprung 4473f863c6
Commit 0ee80dc41f
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B
3 geänderte Dateien mit 9 neuen und 5 gelöschten Zeilen

Datei anzeigen

@ -129,7 +129,7 @@ public class TagRewriter {
};
}
public void handle(PacketWrapper wrapper, @Nullable IdRewriteFunction rewriteFunction, List<TagData> newTags) throws Exception {
public void handle(PacketWrapper wrapper, @Nullable IdRewriteFunction rewriteFunction, @Nullable List<TagData> newTags) throws Exception {
int tagsSize = wrapper.read(Type.VAR_INT);
wrapper.write(Type.VAR_INT, newTags != null ? tagsSize + newTags.size() : tagsSize); // add new tags count

Datei anzeigen

@ -58,8 +58,11 @@ public class ComponentRewriter1_13 extends ComponentRewriter {
try {
tag = BinaryTagIO.readString(text);
} catch (Exception e) {
Via.getPlatform().getLogger().warning("Error reading NBT in show_item:" + text);
throw new RuntimeException(e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
Via.getPlatform().getLogger().warning("Error reading NBT in show_item:" + text);
e.printStackTrace();
}
return;
}
CompoundTag itemTag = tag.get("tag");

Datei anzeigen

@ -24,6 +24,7 @@ import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.ClientboundPacketType;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.rewriters.MetadataRewriter;
import us.myles.ViaVersion.api.rewriters.RegistryType;
import us.myles.ViaVersion.api.rewriters.SoundRewriter;
import us.myles.ViaVersion.api.rewriters.StatisticsRewriter;
@ -50,7 +51,7 @@ public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, Cli
@Override
protected void registerPackets() {
new MetadataRewriter1_17To1_16_4(this);
MetadataRewriter metadataRewriter = new MetadataRewriter1_17To1_16_4(this);
EntityPackets.register(this);
InventoryPackets.register(this);
@ -87,7 +88,7 @@ public class Protocol1_17To1_16_4 extends Protocol<ClientboundPackets1_16_2, Cli
}
});
new StatisticsRewriter(this, null).register(ClientboundPackets1_16_2.STATISTICS);
new StatisticsRewriter(this, metadataRewriter::getNewEntityId).register(ClientboundPackets1_16_2.STATISTICS);
SoundRewriter soundRewriter = new SoundRewriter(this);
soundRewriter.registerSound(ClientboundPackets1_16_2.SOUND);