diff --git a/core/src/main/java/nl/matsv/viabackwards/api/rewriters/SoundRewriter.java b/core/src/main/java/nl/matsv/viabackwards/api/rewriters/SoundRewriter.java index 7be98991..06bb4720 100644 --- a/core/src/main/java/nl/matsv/viabackwards/api/rewriters/SoundRewriter.java +++ b/core/src/main/java/nl/matsv/viabackwards/api/rewriters/SoundRewriter.java @@ -8,16 +8,12 @@ import us.myles.ViaVersion.packets.State; import java.util.function.Function; -public class SoundRewriter { +public class SoundRewriter extends us.myles.ViaVersion.api.rewriters.SoundRewriter { - private final BackwardsProtocol protocol; - // Can't hold the mappings instance here since it's loaded later - private final IdRewriteFunction idRewriter; private final Function stringIdRewriter; public SoundRewriter(BackwardsProtocol protocol, IdRewriteFunction idRewriter, Function stringIdRewriter) { - this.protocol = protocol; - this.idRewriter = idRewriter; + super(protocol, idRewriter); this.stringIdRewriter = stringIdRewriter; } @@ -25,23 +21,6 @@ public class SoundRewriter { this(protocol, idRewriter, null); } - // The same for entity sound effect - public void registerSound(int oldId, int newId) { - protocol.registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() { - @Override - public void registerMap() { - map(Type.VAR_INT); // Sound Id - handler(wrapper -> { - int soundId = wrapper.get(Type.VAR_INT, 0); - int mappedId = idRewriter.rewrite(soundId); - if (mappedId != -1 && soundId != mappedId) { - wrapper.set(Type.VAR_INT, 0, mappedId); - } - }); - } - }); - } - public void registerNamedSound(int oldId, int newId) { protocol.registerOutgoing(State.PLAY, oldId, newId, new PacketRemapper() { @Override