Package alexiil.mc.lib.net
Class NetIdDataK<T>
java.lang.Object
alexiil.mc.lib.net.TreeNetIdBase
alexiil.mc.lib.net.NetIdBase
alexiil.mc.lib.net.NetIdTyped<T>
alexiil.mc.lib.net.NetIdDataK<T>
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
-
Field Summary
Fields inherited from class alexiil.mc.lib.net.NetIdTyped
parent
Fields inherited from class alexiil.mc.lib.net.NetIdBase
DEFAULT_FLAGS, MAXIMUM_PRIORITY
Fields inherited from class alexiil.mc.lib.net.TreeNetIdBase
DYNAMIC_LENGTH, fullName, length, name, totalLength
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
receive(NetByteBuf buffer, IMsgReadCtx ctx, T parentValue)
void
send(ActiveConnection connection, T obj)
Sends this signal over the specified connectionvoid
send(ActiveConnection connection, T obj, NetIdDataK.IMsgDataWriterK<T> writer)
setReadWrite(NetIdDataK.IMsgDataReceiverK<T> receiver, NetIdDataK.IMsgDataWriterK<T> writer)
setReceiver(NetIdDataK.IMsgDataReceiverK<T> receiver)
Changes the flags for this packet to indicate that it should only be sent from the server to the client.This clears theNetIdBase.toClientOnly()
andNetIdBase.toServerOnly()
flag states, and will make sending packets not throw exceptions.Changes the flags for this packet to indicate that it should only be sent from the client to the server.Changes the size flags of this net ID to indicate that it should use three bytes for the packet's total length (including the header).Changes the size flags of this net ID to indicate that it should use two bytes for the packet's total length (including the header).Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
.Changes the size flags of this net ID to indicate that it should use a single byte for the packet's total length (including the header).Methods inherited from class alexiil.mc.lib.net.NetIdTyped
getPrintableName
Methods inherited from class alexiil.mc.lib.net.NetIdBase
_toClientOnly, _toEitherSide, _toServerOnly, buffered, changeFlag, notBuffered, setBuffered, setLargeSize, setMaximumDropDelay, setNormalSize, setTinySize
Methods inherited from class alexiil.mc.lib.net.TreeNetIdBase
equals, getRealClassName, hasFixedLength, hashCode, toString
-
Constructor Details
-
NetIdDataK
-
-
Method Details
-
setReceiver
-
setReadWrite
public NetIdDataK<T> setReadWrite(NetIdDataK.IMsgDataReceiverK<T> receiver, NetIdDataK.IMsgDataWriterK<T> writer) -
receive
public void receive(NetByteBuf buffer, IMsgReadCtx ctx, T parentValue) throws InvalidInputDataException- Specified by:
receive
in classNetIdTyped<T>
- Throws:
InvalidInputDataException
-
send
Sends this signal over the specified connection- Specified by:
send
in classNetIdTyped<T>
-
send
-
withoutBuffering
Description copied from class:NetIdBase
Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
. This means that it will arrive on the other end of the connection before other packets that don't have this flag set. Sending a lot of these "queue-skipping packets" will generally have a large impact on performance.Unlike all of the other flag modification methods this may be called at any time, in particular before and after sending this.
This method should be preferred over
NetIdBase.notBuffered()
because it returns itself.- Specified by:
withoutBuffering
in classNetIdBase
- Returns:
- This.
-
withTinySize
Description copied from class:NetIdBase
Changes the size flags of this net ID to indicate that it should use a single byte for the packet's total length (including the header). In other words the maximum packet length is 256 bytes, and the minimum is 1 byte. Has no effect if the packet's length is notfixed
.This method should be preferred over
NetIdBase.setTinySize()
because it returns itself.- Specified by:
withTinySize
in classNetIdBase
- See Also:
NetIdBase.withNormalSize()
,NetIdBase.withLargeSize()
-
withNormalSize
Description copied from class:NetIdBase
Changes the size flags of this net ID to indicate that it should use two bytes for the packet's total length (including the header). In other words the maximum packet length is 65,536 bytes, and the minimum is 1 byte. Has no effect if the packet's length is notfixed
.This method should be preferred over
NetIdBase.setNormalSize()
because it returns itself.- Specified by:
withNormalSize
in classNetIdBase
- See Also:
NetIdBase.withTinySize()
,NetIdBase.withLargeSize()
-
withLargeSize
Description copied from class:NetIdBase
Changes the size flags of this net ID to indicate that it should use three bytes for the packet's total length (including the header). In other words the maximum packet length is 16,777,216 bytes, and the minimum is 1 byte. Has no effect if the packet's length is notfixed
.Unlike all of the other flag modification methods this may be called at any time, in particular before and after sending this.
This method should be preferred over
NetIdBase.setLargeSize()
because it returns itself.- Specified by:
withLargeSize
in classNetIdBase
- See Also:
NetIdBase.withTinySize()
,NetIdBase.withNormalSize()
-
toClientOnly
Description copied from class:NetIdBase
Changes the flags for this packet to indicate that it should only be sent from the server to the client. This will make sending this packet from the client throw an unchecked exception, and make the server refuse to bind this packet to an integer ID for receiving.- Specified by:
toClientOnly
in classNetIdBase
- See Also:
NetIdBase.toServerOnly()
-
toServerOnly
Description copied from class:NetIdBase
Changes the flags for this packet to indicate that it should only be sent from the client to the server. This will make sending this packet from the server throw an unchecked exception, and make the client refuse to bind this packet to an integer ID for receiving.- Specified by:
toServerOnly
in classNetIdBase
- See Also:
NetIdBase.toClientOnly()
-
toEitherSide
Description copied from class:NetIdBase
This clears theNetIdBase.toClientOnly()
andNetIdBase.toServerOnly()
flag states, and will make sending packets not throw exceptions.This is the default state for every
NetIdBase
.- Specified by:
toEitherSide
in classNetIdBase
-