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

Ignore errors in book conversion

Dieser Commit ist enthalten in:
Nassim Jahnke 2024-01-29 10:17:00 +01:00
Ursprung cfc9011cee
Commit 01f28a052c
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: EF6771C01F6EF02F
3 geänderte Dateien mit 15 neuen und 7 gelöschten Zeilen

Datei anzeigen

@ -107,7 +107,8 @@ public class ProtocolPipelineImpl extends AbstractSimpleProtocol implements Prot
int originalID = packetWrapper.getId();
DebugHandler debugHandler = Via.getManager().debugHandler();
if (debugHandler.enabled() && !debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) {
boolean debug = debugHandler.enabled();
if (debug && !debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) {
logPacket(direction, state, packetWrapper, originalID);
}
@ -115,13 +116,13 @@ public class ProtocolPipelineImpl extends AbstractSimpleProtocol implements Prot
packetWrapper.apply(direction, state, 0, protocolListFor(direction));
super.transform(direction, state, packetWrapper);
if (debugHandler.enabled() && debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) {
if (debug && debugHandler.logPostPacketTransform() && debugHandler.shouldLog(packetWrapper, direction)) {
logPacket(direction, state, packetWrapper, originalID);
}
}
private List<Protocol> protocolListFor(final Direction direction) {
return Collections.unmodifiableList(direction == Direction.SERVERBOUND ? protocolList : reversedProtocolList);
return direction == Direction.SERVERBOUND ? protocolList : reversedProtocolList;
}
private void logPacket(Direction direction, State state, PacketWrapper packetWrapper, int originalID) {

Datei anzeigen

@ -22,6 +22,7 @@ import com.github.steveice10.opennbt.tag.builtin.ListTag;
import com.github.steveice10.opennbt.tag.builtin.StringTag;
import com.github.steveice10.opennbt.tag.builtin.Tag;
import com.google.gson.JsonElement;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.data.ParticleMappings;
import com.viaversion.viaversion.api.minecraft.Particle;
import com.viaversion.viaversion.api.minecraft.item.Item;
@ -160,8 +161,14 @@ public final class BlockItemPacketRewriter1_20_3 extends ItemRewriter<Clientboun
}
final StringTag stringTag = (StringTag) pageTag;
final JsonElement updatedComponent = ComponentUtil.convertJson(stringTag.getValue(), ComponentUtil.SerializerVersion.V1_19_4, ComponentUtil.SerializerVersion.V1_20_3);
stringTag.setValue(updatedComponent.toString());
try {
final JsonElement updatedComponent = ComponentUtil.convertJson(stringTag.getValue(), ComponentUtil.SerializerVersion.V1_19_4, ComponentUtil.SerializerVersion.V1_20_3);
stringTag.setValue(updatedComponent.toString());
} catch (final Exception e) {
if (Via.getManager().isDebug()) {
e.printStackTrace();
}
}
}
}
}

Datei anzeigen

@ -82,7 +82,7 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
/**
* Returns a meta filter builder.
* <p>
* Calling {@link MetaFilter.Builder#register()} will automatically register the filter on this rewriter.
* Calling {@link com.viaversion.viaversion.rewriter.meta.MetaFilter.Builder#register()} will automatically register the filter on this rewriter.
*
* @return meta filter builder
*/
@ -92,7 +92,7 @@ public abstract class EntityRewriter<C extends ClientboundPacketType, T extends
/**
* Registers a metadata filter.
* Note that {@link MetaFilter.Builder#register()} already calls this method.
* Note that {@link com.viaversion.viaversion.rewriter.meta.MetaFilter.Builder#register()} already calls this method.
*
* @param filter filter to register
* @throws IllegalArgumentException if the filter is already registered