Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/rewriter/ChatComponentRewriter.java
This commit is contained in:
RaphiMC 2024-04-21 22:55:17 +02:00
commit 8a0e63dbfd
No known key found for this signature in database
GPG Key ID: 0F6BB0657A03AC94
9 changed files with 44 additions and 15 deletions

View File

@ -103,7 +103,9 @@ public class Protocolc0_30toc0_30cpe extends StatelessProtocol<ClientboundPacket
if (extension != null) {
protocolMetadataStorage.addServerExtension(extension, extensionVersion);
} else {
ViaLegacy.getPlatform().getLogger().warning("Received unknown classic protocol extension: (" + extensionName + " v" + extensionVersion + ")");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Received unknown classic protocol extension: (" + extensionName + " v" + extensionVersion + ")");
}
}
protocolMetadataStorage.incrementReceivedExtensions();

View File

@ -455,7 +455,9 @@ public class Protocol1_3_1_2to1_2_4_5 extends StatelessProtocol<ClientboundPacke
wrapper.user().get(ChestStateTracker.class).unload(chunk.getX(), chunk.getZ());
if (chunk.isFullChunk() && chunk.getBitmask() == 0) { // Remap to empty chunk
ViaLegacy.getPlatform().getLogger().warning("Received empty 1.2.5 chunk packet");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Received empty 1.2.5 chunk packet");
}
chunk = ChunkUtil.createEmptyChunk(chunk.getX(), chunk.getZ());
if (dimension == Environment.NORMAL) {
ChunkUtil.setDummySkylight(chunk, true);

View File

@ -229,7 +229,9 @@ public class Protocol1_4_2to1_3_1_2 extends StatelessProtocol<ClientboundPackets
String newSound = SoundRewriter.map(oldSound);
if (oldSound.isEmpty()) newSound = "";
if (newSound == null) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.3.2 sound '" + oldSound + "'");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.3.2 sound '" + oldSound + "'");
}
newSound = "";
}
if (newSound.isEmpty()) {

View File

@ -252,7 +252,9 @@ public class Protocol1_6_1to1_5_2 extends StatelessProtocol<ClientboundPackets1_
String newSound = SoundRewriter.map(oldSound);
if (oldSound.isEmpty()) newSound = "";
if (newSound == null) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.5.2 sound '" + oldSound + "'");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.5.2 sound '" + oldSound + "'");
}
newSound = "";
}
if (newSound.isEmpty()) {

View File

@ -17,6 +17,7 @@
*/
package net.raphimc.vialegacy.protocols.release.protocol1_6_1to1_5_2.metadata;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.metadata.Metadata;
import net.raphimc.vialegacy.ViaLegacy;
@ -56,12 +57,16 @@ public class MetadataRewriter {
case Position:
break;
default:
ViaLegacy.getPlatform().getLogger().warning("1.5.2 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("1.5.2 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
}
list.remove(entry);
break;
}
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
}
list.remove(entry);
}
}

View File

@ -489,7 +489,9 @@ public class Protocol1_7_2_5to1_6_4 extends StatelessTransitionProtocol<Clientbo
String newSound = SoundRewriter.map(oldSound);
if (oldSound.isEmpty()) newSound = "";
if (newSound == null) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.6.4 sound '" + oldSound + "'");
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unable to map 1.6.4 sound '" + oldSound + "'");
}
newSound = "";
}
if (newSound.isEmpty()) {

View File

@ -763,7 +763,9 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
Particle particle = Particle.find(parts[0]);
if (particle == null) {
particle = Particle.BARRIER;
ViaLegacy.getPlatform().getLogger().warning("Could not find 1.8 particle for " + Arrays.toString(parts));
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Could not find 1.8 particle for " + Arrays.toString(parts));
}
}
wrapper.write(Type.INT, particle.ordinal()); // particle id
wrapper.write(Type.BOOLEAN, false); // long distance
@ -1369,7 +1371,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
final String channel = wrapper.read(Type.STRING); // channel
if (ViaLegacy.getConfig().isIgnoreLong1_8ChannelNames() && channel.length() > 16) {
if (!Via.getConfig().isSuppressConversionWarnings()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Ignoring serverbound plugin channel, as it is longer than 16 characters: '" + channel + "'");
}
wrapper.cancel();
@ -1398,7 +1400,9 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
} else if (type == 1) {
wrapper.passthrough(Type.INT); // entity id
} else {
ViaLegacy.getPlatform().getLogger().warning("Unknown 1.8 command block type: " + type);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Unknown 1.8 command block type: " + type);
}
wrapper.cancel();
return;
}
@ -1414,7 +1418,7 @@ public class Protocol1_8to1_7_6_10 extends AbstractProtocol<ClientboundPackets1_
final List<String> validChannels = new ArrayList<>(registeredChannels.length);
for (String registeredChannel : registeredChannels) {
if (registeredChannel.length() > 16) {
if (!Via.getConfig().isSuppressConversionWarnings()) {
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Ignoring serverbound plugin channel register of '" + registeredChannel + "', as it is longer than 16 characters");
}
continue;

View File

@ -17,6 +17,7 @@
*/
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.metadata;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.entities.EntityTypes1_10;
import com.viaversion.viaversion.api.minecraft.item.Item;
@ -43,7 +44,9 @@ public class MetadataRewriter {
final MetaIndex1_8to1_7_6 metaIndex = MetaIndex1_8to1_7_6.searchIndex(type, entry.id());
try {
if (metaIndex == null) {
ViaLegacy.getPlatform().getLogger().warning("Could not find valid metaindex entry for " + type.name() + ": " + entry);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("Could not find valid metaindex entry for " + type.name() + ": " + entry);
}
list.remove(entry);
continue;
}
@ -103,12 +106,16 @@ public class MetadataRewriter {
case Rotation:
break;
default:
ViaLegacy.getPlatform().getLogger().warning("1.7.10 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().warning("1.7.10 MetaDataType: Unhandled Type: " + metaIndex.getNewType() + " " + entry);
}
list.remove(entry);
break;
}
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error rewriting metadata entry for " + type.name() + ": " + entry, e);
}
list.remove(entry);
}
}

View File

@ -18,6 +18,7 @@
package net.raphimc.vialegacy.protocols.release.protocol1_8to1_7_6_10.rewriter;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.connection.UserConnection;
import com.viaversion.viaversion.api.minecraft.item.DataItem;
import com.viaversion.viaversion.api.minecraft.item.Item;
@ -471,7 +472,9 @@ public class ChatComponentRewriter {
c.getStyle().setHoverEvent(new TextHoverEvent(textHoverEvent.getAction(), new StringComponent(SNbtSerializer.V1_8.serialize(tag))));
} catch (Throwable e) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error remapping NBT in show_item:" + textHoverEvent.getText().asUnformattedString(), e);
if (!Via.getConfig().isSuppressConversionWarnings() || Via.getManager().isDebug()) {
ViaLegacy.getPlatform().getLogger().log(Level.WARNING, "Error remapping NBT in show_item:" + textHoverEvent.getText().asUnformattedString(), e);
}
c.getStyle().setHoverEvent(new TextHoverEvent(textHoverEvent.getAction(), new StringComponent())); // Invalid item
}
}