public static enum NetworkTarget.Side extends java.lang.Enum<NetworkTarget.Side>
A side specifies the current scope of the execution environment. Use
get() to check your current side in order to react differently
on the server or client side. Some methods may only be run on a specific
side, see assertSide(Side).
Design your NOVA mod with two different sides in mind, or they might only run client side and crash your game when attempting to run the mod on the server side!
By convention, Sided is used to mark a sided type. Any reference
to it from the wrong side, be it in form of a variable, a method call, or
anything else that might cause the desired type to load might inevidably
crash your game, causing an NetworkTarget.IllegalSideException,
ReflectiveOperationException or worse.
| Enum Constant and Description |
|---|
BOTH
BOTH is used by
NetworkTarget to specify that an object has
to be processed by both sides, SERVER and CLIENT. |
CLIENT
The client side.
|
NONE
NONE is used by
NetworkTarget to specify that an object has
been processed, and finished its queue. |
SERVER
The server side.
|
| Modifier and Type | Method and Description |
|---|---|
void |
assertSide()
Shorthand for
Side.assertSide(this) |
static void |
assertSide(NetworkTarget.Side side)
Checks if the current execution environment is of the desired side.
|
static NetworkTarget.Side |
get()
Returns the
NetworkTarget.Side of the current execution environment. |
boolean |
isClient()
Check if the provided side is the client side, shorthand for
side == Side.CLIENT. |
boolean |
isServer()
Check if the provided side is the server side, shorthand for
side == Side.SERVER. |
NetworkTarget.Side |
opposite()
|
NetworkTarget.Side |
reduce()
Reduce is used to mark an object that was sent over the network as
already processed from the opposing side.
|
boolean |
targets(NetworkTarget.Side otherSide)
Check if the given side is a valid target for this side.
|
static NetworkTarget.Side |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static NetworkTarget.Side[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final NetworkTarget.Side CLIENT
World or Entities. Any
changes on the client side have to be synchronized with the
SERVER side using Packets or internal
synchronizing methods as provided by Entity and
others.NetworkTarget,
NetworkManager,
SERVERpublic static final NetworkTarget.Side SERVER
CLIENT, every interaction with the game world has to be
synchronized in order to see the effects on the client. The server
doesn't handle rendering usually.NetworkTarget,
NetworkManager,
CLIENTpublic static final NetworkTarget.Side BOTH
NetworkTarget to specify that an object has
to be processed by both sides, SERVER and CLIENT.public static final NetworkTarget.Side NONE
NetworkTarget to specify that an object has
been processed, and finished its queue.public static NetworkTarget.Side[] values()
for (NetworkTarget.Side c : NetworkTarget.Side.values()) System.out.println(c);
public static NetworkTarget.Side valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is nullpublic static void assertSide(NetworkTarget.Side side)
side - desired NetworkTarget.SideNetworkTarget.IllegalSideException - if the side doesn't matchpublic static NetworkTarget.Side get()
NetworkTarget.Side of the current execution environment.NetworkManager.getSide()public boolean targets(NetworkTarget.Side otherSide)
BOTH.otherSide - side to check fortrue if otherSide is a valid target.public boolean isServer()
side == Side.SERVER.true if the current side is SERVER.public boolean isClient()
side == Side.CLIENT.true if the current side is CLIENT.public NetworkTarget.Side opposite()
public NetworkTarget.Side reduce()
BOTH.SidedEventBuspublic void assertSide()
Side.assertSide(this)