3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-25 15:50:10 +01:00

Convert the Elytra sound properly they added in 1.9.2. Fix #430 (#432)

* Convert the Elytra sound properly they added in 1.9.2. Fix #430

* Change wrong version in comment

* Remove the passthrough
Dieser Commit ist enthalten in:
Mats 2016-06-09 17:03:01 +02:00 committet von Myles
Ursprung f1b81f77d6
Commit 1a4388b3e7
2 geänderte Dateien mit 42 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -1,7 +1,9 @@
package us.myles.ViaVersion.protocols.protocol1_9_1to1_9;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
@ -24,6 +26,24 @@ public class Protocol1_9_1TO1_9 extends Protocol {
map(Type.BOOLEAN); // 6 - Reduced Debug info
}
});
// Sound Effect Packet
registerOutgoing(State.PLAY, 0x47, 0x47, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound ID
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
int sound = wrapper.get(Type.VAR_INT, 0);
if (sound >= 415) // Add 1 to every sound id since there is no Elytra sound on a 1.9 server
wrapper.set(Type.VAR_INT, 0, sound + 1);
}
});
}
});
}
@Override

Datei anzeigen

@ -1,7 +1,9 @@
package us.myles.ViaVersion.protocols.protocol1_9to1_9_1;
import us.myles.ViaVersion.api.PacketWrapper;
import us.myles.ViaVersion.api.data.UserConnection;
import us.myles.ViaVersion.api.protocol.Protocol;
import us.myles.ViaVersion.api.remapper.PacketHandler;
import us.myles.ViaVersion.api.remapper.PacketRemapper;
import us.myles.ViaVersion.api.type.Type;
import us.myles.ViaVersion.packets.State;
@ -24,6 +26,26 @@ public class Protocol1_9TO1_9_1 extends Protocol {
map(Type.BOOLEAN); // 6 - Reduced Debug info
}
});
// Sound Effect Packet
registerOutgoing(State.PLAY, 0x47, 0x47, new PacketRemapper() {
@Override
public void registerMap() {
map(Type.VAR_INT); // 0 - Sound ID
handler(new PacketHandler() {
@Override
public void handle(PacketWrapper wrapper) throws Exception {
int sound = wrapper.get(Type.VAR_INT, 0);
if (sound == 415) // Stop the Elytra sound for 1.9 (It's introduced in 1.9.2)
wrapper.cancel();
else if (sound >= 416) // Act like the Elytra sound never existed
wrapper.set(Type.VAR_INT, 0, sound - 1);
}
});
}
});
}
@Override