Skip to content

Commit

Permalink
Force-enable NETWORK side effect to ensure blocks are instantly visib…
Browse files Browse the repository at this point in the history
…le (#4558)
  • Loading branch information
SirYwell authored Dec 30, 2024
1 parent 47d1f1e commit effbacb
Showing 1 changed file with 22 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,19 +62,28 @@ public class BukkitQueueCoordinator extends BasicQueueCoordinator {
private static final SideEffectSet EDGE_LIGHTING_SIDE_EFFECT_SET;

static {
NO_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.LIGHTING, SideEffect.State.OFF).with(
SideEffect.NEIGHBORS,
SideEffect.State.OFF
);
EDGE_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with(
SideEffect.NEIGHBORS,
SideEffect.State.ON
);
LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
EDGE_LIGHTING_SIDE_EFFECT_SET = SideEffectSet.none().with(SideEffect.UPDATE, SideEffect.State.ON).with(
SideEffect.NEIGHBORS,
SideEffect.State.ON
);
NO_SIDE_EFFECT_SET = enableNetworkIfNeeded()
.with(SideEffect.LIGHTING, SideEffect.State.OFF)
.with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
EDGE_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET
.with(SideEffect.UPDATE, SideEffect.State.ON)
.with(SideEffect.NEIGHBORS, SideEffect.State.ON);
LIGHTING_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET
.with(SideEffect.NEIGHBORS, SideEffect.State.OFF);
EDGE_LIGHTING_SIDE_EFFECT_SET = NO_SIDE_EFFECT_SET
.with(SideEffect.UPDATE, SideEffect.State.ON)
.with(SideEffect.NEIGHBORS, SideEffect.State.ON);
}

// make sure block changes are sent
private static SideEffectSet enableNetworkIfNeeded() {
SideEffect network;
try {
network = SideEffect.valueOf("NETWORK");
} catch (IllegalArgumentException ignored) {
return SideEffectSet.none();
}
return SideEffectSet.none().with(network, SideEffect.State.ON);
}

private org.bukkit.World bukkitWorld;
Expand Down

0 comments on commit effbacb

Please sign in to comment.