Remove bad 1.13->1.12 sound warning, update shadow

Fixes #424
This commit is contained in:
Nassim Jahnke 2022-01-03 18:38:01 +01:00
parent 7a19cb8d04
commit 0d5661f8a6
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
3 changed files with 8 additions and 11 deletions

View File

@ -8,5 +8,5 @@ repositories {
dependencies { dependencies {
// version must be manually kept in sync with the one in root project settings.gradle.kts // version must be manually kept in sync with the one in root project settings.gradle.kts
implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.1") implementation("gradle.plugin.com.github.johnrengelman", "shadow", "7.1.2")
} }

View File

@ -17,10 +17,8 @@
*/ */
package com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.packets; package com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.packets;
import com.viaversion.viabackwards.ViaBackwards;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.Protocol1_12_2To1_13;
import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data.NamedSoundMapping; import com.viaversion.viabackwards.protocol.protocol1_12_2to1_13.data.NamedSoundMapping;
import com.viaversion.viaversion.api.Via;
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper; import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
import com.viaversion.viaversion.api.rewriter.RewriterBase; import com.viaversion.viaversion.api.rewriter.RewriterBase;
import com.viaversion.viaversion.api.type.Type; import com.viaversion.viaversion.api.type.Type;
@ -39,14 +37,13 @@ public class SoundPackets1_13 extends RewriterBase<Protocol1_12_2To1_13> {
protocol.registerClientbound(ClientboundPackets1_13.NAMED_SOUND, new PacketRemapper() { protocol.registerClientbound(ClientboundPackets1_13.NAMED_SOUND, new PacketRemapper() {
@Override @Override
public void registerMap() { public void registerMap() {
map(Type.STRING);
handler(wrapper -> { handler(wrapper -> {
String newSound = wrapper.get(Type.STRING, 0); String sound = wrapper.read(Type.STRING);
String oldSound = NamedSoundMapping.getOldId(newSound); String mappedSound = NamedSoundMapping.getOldId(sound);
if (oldSound != null || (oldSound = protocol.getMappingData().getMappedNamedSound(newSound)) != null) { if (mappedSound != null || (mappedSound = protocol.getMappingData().getMappedNamedSound(sound)) != null) {
wrapper.set(Type.STRING, 0, oldSound); wrapper.write(Type.STRING, mappedSound);
} else if (!Via.getConfig().isSuppressConversionWarnings()) { } else {
ViaBackwards.getPlatform().getLogger().warning("Unknown named sound in 1.13->1.12 protocol: " + newSound); wrapper.write(Type.STRING, sound);
} }
}); });
} }

View File

@ -18,7 +18,7 @@ dependencyResolutionManagement {
pluginManagement { pluginManagement {
plugins { plugins {
id("net.kyori.blossom") version "1.2.0" id("net.kyori.blossom") version "1.2.0"
id("com.github.johnrengelman.shadow") version "7.1.1" id("com.github.johnrengelman.shadow") version "7.1.2"
} }
} }