Class NetIdBase
- Direct Known Subclasses:
NetIdSeparate
,NetIdTyped
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
static 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 void
Impl fortoClientOnly()
protected void
Impl fortoEitherSide()
protected void
Impl fortoServerOnly()
void
buffered()
The inverse ofnotBuffered()
.protected void
changeFlag(int newFlags)
void
Changes the flags for this packet to indicate that it should never be buffered by aBufferedConnection
.void
setBuffered(boolean isBuffered)
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.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).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:
- Constant Field Values
-
DEFAULT_FLAGS
public static final int DEFAULT_FLAGS- See Also:
- Constant Field Values
-
-
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:
setNormalSize()
,setLargeSize()
-
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:
withNormalSize()
,withLargeSize()
-
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:
setTinySize()
,setLargeSize()
-
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:
withTinySize()
,withLargeSize()
-
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:
setTinySize()
,setNormalSize()
-
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:
withTinySize()
,withNormalSize()
-
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 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.
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 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
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()
-
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:
toClientOnly()
-
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)
-