Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/net/raphimc/vialegacy/protocols/release/protocol1_8to1_7_6_10/rewriter/ChatComponentRewriter.java
  • Loading branch information
RaphiMC committed Apr 21, 2024
2 parents a48c470 + eeb8ca5 commit 8a0e63d
Showing 9 changed files with 44 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -103,7 +103,9 @@ protected void registerPackets() {
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();
Original file line number Diff line number Diff line change
@@ -455,7 +455,9 @@ public void register() {
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);
Original file line number Diff line number Diff line change
@@ -229,7 +229,9 @@ public void register() {
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()) {
Original file line number Diff line number Diff line change
@@ -252,7 +252,9 @@ public void register() {
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()) {
Original file line number Diff line number Diff line change
@@ -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 static void transform(final EntityTypes1_10.EntityType type, final List<M
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);
}
}
Original file line number Diff line number Diff line change
@@ -489,7 +489,9 @@ public void register() {
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()) {
Original file line number Diff line number Diff line change
@@ -763,7 +763,9 @@ public void register() {
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 void register() {
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 void register() {
} 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 void register() {
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;
Original file line number Diff line number Diff line change
@@ -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 void transform(final UserConnection user, final EntityTypes1_10.EntityTyp
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 void transform(final UserConnection user, final EntityTypes1_10.EntityTyp
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);
}
}
Original file line number Diff line number Diff line change
@@ -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 String toClient(final UserConnection user, final String text) {

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
}
}

0 comments on commit 8a0e63d

Please sign in to comment.