mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-22 10:05:12 +01:00
Expose PacketTypesProvider in Protocol
This commit is contained in:
parent
a6e1cb6534
commit
5cad29c754
@ -404,6 +404,11 @@ public abstract class AbstractProtocol<CU extends ClientboundPacketType, CM exte
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PacketTypesProvider<CU, CM, SM, SU> getPacketTypesProvider() {
|
||||
return packetTypesProvider;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @Nullable <T> T get(Class<T> objectClass) {
|
||||
//noinspection unchecked
|
||||
|
@ -22,6 +22,7 @@
|
||||
*/
|
||||
package com.viaversion.viaversion.api.protocol;
|
||||
|
||||
import com.google.common.annotations.Beta;
|
||||
import com.viaversion.viaversion.api.connection.UserConnection;
|
||||
import com.viaversion.viaversion.api.data.MappingData;
|
||||
import com.viaversion.viaversion.api.platform.providers.ViaProviders;
|
||||
@ -30,6 +31,7 @@ import com.viaversion.viaversion.api.protocol.packet.Direction;
|
||||
import com.viaversion.viaversion.api.protocol.packet.PacketWrapper;
|
||||
import com.viaversion.viaversion.api.protocol.packet.ServerboundPacketType;
|
||||
import com.viaversion.viaversion.api.protocol.packet.State;
|
||||
import com.viaversion.viaversion.api.protocol.packet.provider.PacketTypesProvider;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketHandler;
|
||||
import com.viaversion.viaversion.api.protocol.remapper.PacketRemapper;
|
||||
import com.viaversion.viaversion.api.rewriter.EntityRewriter;
|
||||
@ -236,6 +238,15 @@ public interface Protocol<CU extends ClientboundPacketType, CM extends Clientbou
|
||||
*/
|
||||
void transform(Direction direction, State state, PacketWrapper packetWrapper) throws Exception;
|
||||
|
||||
/**
|
||||
* Returns a packet type provider for this protocol to get packet types by id.
|
||||
* Depending on the Protocol, not every state may be populated.
|
||||
*
|
||||
* @return the packet types provider
|
||||
*/
|
||||
@Beta
|
||||
PacketTypesProvider<CU, CM, SM, SU> getPacketTypesProvider();
|
||||
|
||||
/**
|
||||
* Returns a cached object by the given type if present.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user