Class PacketHandlers
java.lang.Object
com.viaversion.viaversion.api.protocol.remapper.PacketHandlers
- All Implemented Interfaces:
PacketHandler
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription<T> void
Writes a value.final void
handle
(PacketWrapper wrapper) Handles a packet.void
handler
(PacketHandler handler) Adds a packet handler.void
handlerSoftFail
(PacketHandler handler) Adds a packet handler which will suppress any exceptions thrown by the handler.int
<T> void
map
(ValueReader<T> inputReader, ValueWriter<T> outputWriter) Maps a type using a basic ValueReader to a ValueWriter.<T1,
T2> void map
(ValueTransformer<T1, T2> transformer) Maps a type from an old type to a transformed new type based on their input type.void
Reads the first given type and writes the second given type.<T> void
Reads and writes the given type.<T1,
T2> void map
(Type<T1> oldType, ValueTransformer<T1, T2> transformer) Maps a type from an old type to a transformed new type.<T1,
T2> void Maps a type from an old type to a transformed new type.void
Reads (and thus removes) the given type.protected abstract void
register()
Registers the handlers for this packet.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.viaversion.viaversion.api.protocol.remapper.PacketHandler
then
-
Constructor Details
-
PacketHandlers
protected PacketHandlers()
-
-
Method Details
-
map
Reads and writes the given type.- Parameters:
type
- type to map
-
map
Reads the first given type and writes the second given type.- Parameters:
oldType
- old typenewType
- new type
-
map
Maps a type from an old type to a transformed new type.- Type Parameters:
T1
- old value typeT2
- new value type- Parameters:
oldType
- old typenewType
- new typetransformer
- transformer to produce the new type
-
map
Maps a type from an old type to a transformed new type based on their input type.- Type Parameters:
T1
- old value typeT2
- new value type- Parameters:
transformer
- transformer to produce the new type
-
map
Maps a type from an old type to a transformed new type.- Type Parameters:
T1
- old value typeT2
- new value type- Parameters:
oldType
- old typetransformer
- transformer to produce the new type
-
map
Maps a type using a basic ValueReader to a ValueWriter.- Type Parameters:
T
- read/write type- Parameters:
inputReader
- reader to read withoutputWriter
- writer to write with
-
handler
Adds a packet handler.- Parameters:
handler
- packet handler
-
handlerSoftFail
Adds a packet handler which will suppress any exceptions thrown by the handler.- Parameters:
handler
- packet handler
-
create
Writes a value.- Parameters:
type
- type to writevalue
- value to write
-
read
Reads (and thus removes) the given type.- Parameters:
type
- type to read
-
register
protected abstract void register()Registers the handlers for this packet. -
handle
Description copied from interface:PacketHandler
Handles a packet.- Specified by:
handle
in interfacePacketHandler
- Parameters:
wrapper
- packet wrapper- Throws:
InformativeException
-
handlersSize
public int handlersSize()
-