Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2024-12-26 16:12:43 +01:00
Fix named sound remapping
Dieser Commit ist enthalten in:
Ursprung
859a79d7da
Commit
8dfacde007
@ -113,7 +113,15 @@ public class BackwardsMappings extends MappingData {
|
|||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public String getMappedNamedSound(String id) {
|
public String getMappedNamedSound(String id) {
|
||||||
return backwardsSoundMappings != null ? backwardsSoundMappings.get(id) : null;
|
if (backwardsItemMappings == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (id.indexOf(':') == -1) {
|
||||||
|
id = "minecraft:" + id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return backwardsSoundMappings.get(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
@ -37,10 +37,6 @@ public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewrit
|
|||||||
public PacketHandler getNamedSoundHandler() {
|
public PacketHandler getNamedSoundHandler() {
|
||||||
return wrapper -> {
|
return wrapper -> {
|
||||||
String soundId = wrapper.get(Type.STRING, 0);
|
String soundId = wrapper.get(Type.STRING, 0);
|
||||||
if (soundId.startsWith("minecraft:")) {
|
|
||||||
soundId = soundId.substring(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
String mappedId = protocol.getMappingData().getMappedNamedSound(soundId);
|
String mappedId = protocol.getMappingData().getMappedNamedSound(soundId);
|
||||||
if (mappedId == null) return;
|
if (mappedId == null) return;
|
||||||
if (!mappedId.isEmpty()) {
|
if (!mappedId.isEmpty()) {
|
||||||
@ -61,10 +57,6 @@ public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewrit
|
|||||||
}
|
}
|
||||||
|
|
||||||
String soundId = wrapper.read(Type.STRING);
|
String soundId = wrapper.read(Type.STRING);
|
||||||
if (soundId.startsWith("minecraft:")) {
|
|
||||||
soundId = soundId.substring(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
String mappedId = protocol.getMappingData().getMappedNamedSound(soundId);
|
String mappedId = protocol.getMappingData().getMappedNamedSound(soundId);
|
||||||
if (mappedId == null) {
|
if (mappedId == null) {
|
||||||
// No mapping found
|
// No mapping found
|
||||||
|
@ -21,6 +21,9 @@ public class NamedSoundMapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getOldId(String sound1_13) {
|
public static String getOldId(String sound1_13) {
|
||||||
|
if (sound1_13.startsWith("minecraft:")) {
|
||||||
|
sound1_13 = sound1_13.substring(10);
|
||||||
|
}
|
||||||
return SOUNDS.get(sound1_13);
|
return SOUNDS.get(sound1_13);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,6 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
map(Type.STRING);
|
map(Type.STRING);
|
||||||
handler(wrapper -> {
|
handler(wrapper -> {
|
||||||
String newSound = wrapper.get(Type.STRING, 0);
|
String newSound = wrapper.get(Type.STRING, 0);
|
||||||
if (newSound.startsWith("minecraft:")) {
|
|
||||||
newSound = newSound.substring(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
String oldSound = NamedSoundMapping.getOldId(newSound);
|
String oldSound = NamedSoundMapping.getOldId(newSound);
|
||||||
if (oldSound != null || (oldSound = protocol.getMappingData().getMappedNamedSound(newSound)) != null) {
|
if (oldSound != null || (oldSound = protocol.getMappingData().getMappedNamedSound(newSound)) != null) {
|
||||||
wrapper.set(Type.STRING, 0, oldSound);
|
wrapper.set(Type.STRING, 0, oldSound);
|
||||||
@ -56,10 +52,6 @@ public class SoundPackets1_13 extends Rewriter<Protocol1_12_2To1_13> {
|
|||||||
String sound;
|
String sound;
|
||||||
if ((flags & 0x02) != 0) {
|
if ((flags & 0x02) != 0) {
|
||||||
String newSound = wrapper.read(Type.STRING);
|
String newSound = wrapper.read(Type.STRING);
|
||||||
if (newSound.startsWith("minecraft:")) {
|
|
||||||
newSound = newSound.substring(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
sound = protocol.getMappingData().getMappedNamedSound(newSound);
|
sound = protocol.getMappingData().getMappedNamedSound(newSound);
|
||||||
if (sound == null) {
|
if (sound == null) {
|
||||||
sound = "";
|
sound = "";
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren