mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-12 10:28:35 +00:00
Cherry pick upstream commits to fix SideEffectSet (#1737)
* Fix SideEffectSet.none() being the default set (#1620) * Fix SideEffectSet.none() being the default set * Remove the unnecessary private empty constructor for SideEffectSet * Back to ImmutableMap.of * Speed up Fast Reorder Mode and make it default (#1653) * Speed up Fast Reorder Mode and make it default * Make non-exposed side effects internal * Docs on isExposed Co-authored-by: Matthew Miller <mnmiller1@me.com>
This commit is contained in:
@ -32,10 +32,13 @@ import com.sk89q.worldedit.world.World;
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@ -50,6 +53,11 @@ public class SideEffectExtent extends AbstractDelegateExtent {
|
||||
private SideEffectSet sideEffectSet = SideEffectSet.defaults();
|
||||
private boolean postEditSimulation;
|
||||
|
||||
private static final SideEffectSet INTERNAL_NONE = new SideEffectSet(
|
||||
Arrays.stream(SideEffect.values())
|
||||
.collect(Collectors.toMap(Function.identity(), state -> SideEffect.State.OFF))
|
||||
);
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
@ -86,7 +94,7 @@ public class SideEffectExtent extends AbstractDelegateExtent {
|
||||
positions.put(location, world.getBlock(location));
|
||||
}
|
||||
|
||||
return world.setBlock(location, block, postEditSimulation ? SideEffectSet.none() : sideEffectSet);
|
||||
return world.setBlock(location, block, postEditSimulation ? INTERNAL_NONE : sideEffectSet);
|
||||
}
|
||||
|
||||
public boolean commitRequired() {
|
||||
|
Reference in New Issue
Block a user