Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-28 00:50:13 +01:00
Move appendClientbound/Serverbound methods to Protocol interface
Dieser Commit ist enthalten in:
Ursprung
0e97af29b4
Commit
9dd3348510
@ -66,7 +66,7 @@ public interface ViaAPI<T> {
|
|||||||
* @return API version incremented with meaningful API changes
|
* @return API version incremented with meaningful API changes
|
||||||
*/
|
*/
|
||||||
default int apiVersion() {
|
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) {
|
public void appendClientbound(final CU type, final PacketHandler handler) {
|
||||||
final PacketMapping mapping = clientboundMappings.mappedPacket(type.state(), type.getId());
|
final PacketMapping mapping = clientboundMappings.mappedPacket(type.state(), type.getId());
|
||||||
if (mapping != null) {
|
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) {
|
public void appendServerbound(final SU type, final PacketHandler handler) {
|
||||||
final PacketMapping mapping = serverboundMappings.mappedPacket(type.state(), type.getId());
|
final PacketMapping mapping = serverboundMappings.mappedPacket(type.state(), type.getId());
|
||||||
if (mapping != null) {
|
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.protocol.remapper.PacketRemapper;
|
||||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||||
import com.viaversion.viaversion.api.rewriter.ItemRewriter;
|
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.rewriter.TagRewriter;
|
||||||
|
import com.viaversion.viaversion.api.type.Type;
|
||||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
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);
|
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
|
* 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
|
* @return object if present, else null
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@Nullable <T> T get(Class<T> objectClass);
|
@Nullable
|
||||||
|
<T> T get(Class<T> objectClass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Caches an object, retrievable by using {@link #get(Class)}.
|
* Caches an object, retrievable by using {@link #get(Class)}.
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren