Skip to content

Commit

Permalink
Force-enable NETWORK side effect to ensure blocks are instantly visible
Browse files Browse the repository at this point in the history
  • Loading branch information
SirYwell committed Dec 22, 2024
1 parent 960b7b2 commit 49fca1c
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 49fca1c

Please sign in to comment.