Deprecate cancelClientbound/Serverbound with new id parameter

This commit is contained in:
Nassim Jahnke 2021-09-05 14:02:33 +02:00
parent f4f7215a6a
commit 68e4146f3b
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 20 additions and 6 deletions

View File

@ -176,6 +176,11 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
});
}
@Override
public void cancelServerbound(State state, int newPacketID) {
cancelServerbound(state, -1, newPacketID);
}
@Override
public void cancelClientbound(State state, int oldPacketID, int newPacketID) {
registerClientbound(state, oldPacketID, newPacketID, new PacketRemapper() {
@ -186,6 +191,11 @@ public abstract class AbstractProtocol<C1 extends ClientboundPacketType, C2 exte
});
}
@Override
public void cancelClientbound(State state, int oldPacketID) {
cancelClientbound(state, oldPacketID, -1);
}
@Override
public void registerClientbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override) {
ProtocolPacket protocolPacket = new ProtocolPacket(state, oldPacketID, newPacketID, packetRemapper);

View File

@ -67,11 +67,13 @@ public interface Protocol<C1 extends ClientboundPacketType, C2 extends Clientbou
*/
void registerServerbound(State state, int oldPacketID, int newPacketID, PacketRemapper packetRemapper, boolean override);
/**
* @deprecated use {@link #cancelServerbound(State, int)}
*/
@Deprecated/*(forRemoval = true)*/
void cancelServerbound(State state, int oldPacketID, int newPacketID);
default void cancelServerbound(State state, int newPacketID) {
cancelServerbound(state, -1, newPacketID);
}
void cancelServerbound(State state, int newPacketID);
default void registerClientbound(State state, int oldPacketID, int newPacketID) {
registerClientbound(state, oldPacketID, newPacketID, null);
@ -81,11 +83,13 @@ public interface Protocol<C1 extends ClientboundPacketType, C2 extends Clientbou
registerClientbound(state, oldPacketID, newPacketID, packetRemapper, false);
}
/**
* @deprecated use {@link #cancelClientbound(State, int)}
*/
@Deprecated/*(forRemoval = true)*/
void cancelClientbound(State state, int oldPacketID, int newPacketID);
default void cancelClientbound(State state, int oldPacketID) {
cancelClientbound(state, oldPacketID, -1);
}
void cancelClientbound(State state, int oldPacketID);
/**
* Registers a clientbound packet, with id transformation and remapper.