mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 18:15:39 +01:00
Move appendClientbound/Serverbound methods to Protocol interface
This commit is contained in:
parent
0e97af29b4
commit
9dd3348510
@ -66,7 +66,7 @@ public interface ViaAPI<T> {
|
||||
* @return API version incremented with meaningful API changes
|
||||
*/
|
||||
default int apiVersion() {
|
||||
return 25;
|
||||
return 26;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -146,6 +146,7 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendClientbound(final CU type, final PacketHandler handler) {
|
||||
final PacketMapping mapping = clientboundMappings.mappedPacket(type.state(), type.getId());
|
||||
if (mapping != null) {
|
||||
@ -155,6 +156,7 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void appendServerbound(final SU type, final PacketHandler handler) {
|
||||
final PacketMapping mapping = serverboundMappings.mappedPacket(type.state(), type.getId());
|
||||
if (mapping != null) {
|
||||
|
@ -36,8 +36,8 @@ import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
||||
import com.viaversion.viaversion.api.rewriter.Rewriter;
|
||||
import com.viaversion.viaversion.api.rewriter.TagRewriter;
|
||||
import com.viaversion.viaversion.api.type.Type;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
||||
/**
|
||||
@ -242,6 +242,28 @@ public interface Protocol<CU extends ClientboundPacketType, CM extends Clientbou
|
||||
*/
|
||||
boolean hasRegisteredServerbound(State state, int unmappedPacketId);
|
||||
|
||||
/**
|
||||
* Appends a clientbound packet type handler with another, as opposed to replacing it entirely.
|
||||
* <p>
|
||||
* Use {@link PacketWrapper#set(Type, int, Object)} to change individual parts, or call
|
||||
* {@link PacketWrapper#resetReader()} to reset the reader index.
|
||||
*
|
||||
* @param type clientbound packet type
|
||||
* @param handler packet handler
|
||||
*/
|
||||
void appendClientbound(CU type, PacketHandler handler);
|
||||
|
||||
/**
|
||||
* Appends a serverbound packet type handler with another, as opposed to replacing it entirely.
|
||||
* <p>
|
||||
* Use {@link PacketWrapper#set(Type, int, Object)} to change individual parts, or call
|
||||
* {@link PacketWrapper#resetReader()} to reset the reader index.
|
||||
*
|
||||
* @param type serverbound packet type
|
||||
* @param handler packet handler
|
||||
*/
|
||||
void appendServerbound(SU type, PacketHandler handler);
|
||||
|
||||
/**
|
||||
* Transform a packet using this protocol
|
||||
*
|
||||
@ -268,7 +290,8 @@ public interface Protocol<CU extends ClientboundPacketType, CM extends Clientbou
|
||||
* @return object if present, else null
|
||||
*/
|
||||
@Deprecated
|
||||
@Nullable <T> T get(Class<T> objectClass);
|
||||
@Nullable
|
||||
<T> T get(Class<T> objectClass);
|
||||
|
||||
/**
|
||||
* Caches an object, retrievable by using {@link #get(Class)}.
|
||||
|
Loading…
Reference in New Issue
Block a user