Class NetIdBase
- Direct Known Subclasses:
NetIdSeparate
,NetIdTyped
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
This priority indicates that this should never be dropped on the sending side.Fields inherited from class alexiil.mc.lib.net.TreeNetIdBase
DYNAMIC_LENGTH, fullName, length, name, parent, totalLength
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Impl fortoClientOnly()
protected final void
Impl fortoEitherSide()
protected final void
Impl fortoServerOnly()
final void
buffered()
The inverse ofnotBuffered()
.protected final void
changeFlag
(int newFlags) final void
Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
.final void
setBuffered
(boolean isBuffered) final void
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).void
setMaximumDropDelay
(int dropDelay) Sets the maximum time that this packet may be held before dropping it.final void
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).final void
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).abstract NetIdBase
Changes the flags for this packet to indicate that it should only be sent from the server to the client.abstract NetIdBase
This clears thetoClientOnly()
andtoServerOnly()
flag states, and will make sending packets not throw exceptions.abstract NetIdBase
Changes the flags for this packet to indicate that it should only be sent from the client to the server.abstract 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).abstract 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).abstract NetIdBase
Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
.abstract 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).Methods inherited from class alexiil.mc.lib.net.TreeNetIdBase
equals, getPrintableName, getRealClassName, hasFixedLength, hashCode, toString
-
Field Details
-
MAXIMUM_PRIORITY
public static final int MAXIMUM_PRIORITYThis priority indicates that this should never be dropped on the sending side. This is the equivalent priority to minecraft's own packets. Generally this should be used for user interaction or other very important packets that must not be delayed or dropped.- See Also:
-
DEFAULT_FLAGS
public static final int DEFAULT_FLAGS- See Also:
-
-
Method Details
-
setTinySize
public final void setTinySize()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
.Generally you should call
withTinySize()
rather than this, as it returns itself rather than nothing.- See Also:
-
withTinySize
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
setTinySize()
because it returns itself.- See Also:
-
setNormalSize
public final void setNormalSize()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
.Generally you should call
withNormalSize()
rather than this, as it returns itself rather than nothing.- See Also:
-
withNormalSize
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
setNormalSize()
because it returns itself.- See Also:
-
setLargeSize
public final void setLargeSize()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
.Generally you should call
withLargeSize()
rather than this, as it returns itself rather than nothing.- See Also:
-
withLargeSize
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
setLargeSize()
because it returns itself.- See Also:
-
notBuffered
public final void notBuffered()Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
. This means that it will caseActiveConnection.flushQueue()
to be called after this is sent. Please note that this does keep packet ordering - any previously written packets (which were buffered) will be read before this one is read. Sending a lot of these "queue-flushing 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.
Generally you should call
withoutBuffering()
rather than this, as it returns itself rather than nothing. -
buffered
public final void buffered()The inverse ofnotBuffered()
. (This is the default state).Unlike all of the other flag modification methods this may be called at any time, in particular before and after sending this.
-
setBuffered
public final void setBuffered(boolean isBuffered) - Parameters:
isBuffered
- If true then this callsbuffered()
, otherwise this callsnotBuffered()
.
-
withoutBuffering
Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
. This means that it will caseActiveConnection.flushQueue()
to be called after this is sent. Please note that this does keep packet ordering - any previously written packets (which were buffered) will be read before this one is read. Sending a lot of these "queue-flushing 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
notBuffered()
because it returns itself.- Returns:
- This.
-
_toClientOnly
protected final void _toClientOnly()Impl fortoClientOnly()
-
_toServerOnly
protected final void _toServerOnly()Impl fortoServerOnly()
-
_toEitherSide
protected final void _toEitherSide()Impl fortoEitherSide()
-
toClientOnly
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.- See Also:
-
toServerOnly
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.- See Also:
-
toEitherSide
This clears thetoClientOnly()
andtoServerOnly()
flag states, and will make sending packets not throw exceptions.This is the default state for every
NetIdBase
. -
setMaximumDropDelay
public void setMaximumDropDelay(int dropDelay) Sets the maximum time that this packet may be held before dropping it. This value is only used if the connection tries to send too much data in a single tick. Negative values are not allowed. This indicates an absolute number of connection ticks (for normal minecraft connections this is every server or client tick). -
changeFlag
protected final void changeFlag(int newFlags)
-