Interface SyncPolicy
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Which players receive a
Attachment's value. Only players who can see the holder are ever asked: those tracking
an entity (plus the entity itself when it's a player), or those with a block entity's chunk loaded.
.sync(SyncPolicy.SELF) // a player's own HUD value
.sync(SyncPolicy.ALL) // everyone who sees the holder, e.g. for rendering
.sync(SyncPolicy.ALL.and((owner, player) -> player.hasPermissions(2)))
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final SyncPolicyEveryone who sees the holder, the player it belongs to included.static final SyncPolicyNever sent; the value lives on the server only.static final SyncPolicyOnly the player the value belongs to.static final SyncPolicyPlayers who see the holder, but not the player it belongs to. -
Method Summary
Modifier and TypeMethodDescriptiondefault SyncPolicyand(SyncPolicy other) default SyncPolicyor(SyncPolicy other) booleanshouldSync(Object owner, net.minecraft.server.level.ServerPlayer player)
-
Field Details
-
NONE
Never sent; the value lives on the server only. -
SELF
Only the player the value belongs to. Nobody, for anything but a player. -
TRACKING
Players who see the holder, but not the player it belongs to. -
ALL
Everyone who sees the holder, the player it belongs to included.
-
-
Method Details
-
shouldSync
- Parameters:
owner- the entity or block entity holding the valueplayer- a player who can see it
-
and
-
or
-