{
* @param notifyAndLight true to to notify and light
* @return true if the block was successfully set (return value may not be accurate)
*/
+ @Deprecated
default > boolean setBlock(BlockVector3 position, B block, boolean notifyAndLight) throws WorldEditException {
- return setBlock(position, block);
+ return setBlock(position, block, notifyAndLight ? SideEffectSet.defaults() : SideEffectSet.none());
}
+ /**
+ * Similar to {@link Extent#setBlock(BlockVector3, BlockStateHolder)} but a
+ * {@code sideEffects} parameter indicates which side effects should be applied
+ * to the block. This includes block updates, lighting, and others. See {@link SideEffect}
+ * for a full list.
+ *
+ * Not all implementations support all side effects. Use
+ * {@link Platform#getSupportedSideEffects()} for a list of supported side effects.
+ * Non-supported side effects will be ignored.
+ *
+ * @param position position of the block
+ * @param block block to set
+ * @param sideEffects which side effects to perform
+ * @return true if the block was successfully set (return value may not be accurate)
+ */
+ > boolean setBlock(BlockVector3 position, B block, SideEffectSet sideEffects) throws WorldEditException;
+
/**
* Notifies the simulation that the block at the given location has
* been changed and it must be re-lighted (and issue other events).
@@ -124,7 +146,20 @@ public interface World extends Extent, Keyed, IChunkCache {
* @param previousType the type of the previous block that was there
* @return true if the block was successfully notified
*/
- boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException;
+ @Deprecated
+ default boolean notifyAndLightBlock(BlockVector3 position, BlockState previousType) throws WorldEditException {
+ return !applySideEffects(position, previousType, SideEffectSet.defaults()).isEmpty();
+ }
+
+ /**
+ * Applies a set of side effects on the given block.
+ *
+ * @param position position of the block
+ * @param previousType the type of the previous block that was there
+ * @param sideEffectSet which side effects to perform
+ * @return a set of side effects that were applied
+ */
+ Set applySideEffects(BlockVector3 position, BlockState previousType, SideEffectSet sideEffectSet) throws WorldEditException;
/**
* Get the light level at the given block.
diff --git a/worldedit-core/src/main/resources/lang/strings.json b/worldedit-core/src/main/resources/lang/strings.json
index fe79f060d..016a3d60d 100644
--- a/worldedit-core/src/main/resources/lang/strings.json
+++ b/worldedit-core/src/main/resources/lang/strings.json
@@ -210,6 +210,10 @@
"worldedit.fast.enabled": "Fast mode enabled. Lighting in the affected chunks may be wrong and/or you may need to rejoin to see changes.",
"worldedit.fast.disabled.already": "Fast mode already disabled.",
"worldedit.fast.enabled.already": "Fast mode already enabled.",
+ "worldedit.fast.sideeffect.set": "Side effect \"{0}\" set to {1}",
+ "worldedit.fast.sideeffect.get": "Side effect \"{0}\" is set to {1}",
+ "worldedit.fast.sideeffect.already-set": "Side effect \"{0}\" is already {1}",
+ "worldedit.fast.sideeffect.set-all": "All side effects set to {0}",
"worldedit.reorder.current": "The reorder mode is {0}",
"worldedit.reorder.set": "The reorder mode is now {0}",
"worldedit.gmask.disabled": "Global mask disabled.",
@@ -494,6 +498,22 @@
"worldedit.selection.sphere.explain.secondary": "Radius set to {0}.",
"worldedit.selection.sphere.explain.secondary-defined": "Radius set to {0} ({1}).",
+ "worldedit.sideeffect.lighting": "Lighting",
+ "worldedit.sideeffect.lighting.description": "Updates block lighting",
+ "worldedit.sideeffect.neighbors": "Neighbors",
+ "worldedit.sideeffect.neighbors.description": "Notifies nearby blocks of changes",
+ "worldedit.sideeffect.validation": "Validation",
+ "worldedit.sideeffect.validation.description": "Validates and fixes inconsistent world state, such as disconnected blocks",
+ "worldedit.sideeffect.entity_ai": "Entity AI",
+ "worldedit.sideeffect.entity_ai.description": "Updates Entity AI paths for the block changes",
+ "worldedit.sideeffect.events": "Mod/Plugin Events",
+ "worldedit.sideeffect.events.description": "Tells other mods/plugins about these changes when applicable",
+ "worldedit.sideeffect.state.on": "On",
+ "worldedit.sideeffect.state.delayed": "Delayed",
+ "worldedit.sideeffect.state.off": "Off",
+ "worldedit.sideeffect.box.current": "Current",
+ "worldedit.sideeffect.box.change-to": "Click to set to {0}",
+
"worldedit.help.command-not-found": "The command '{0}' could not be found.",
"worldedit.help.no-subcommands": "'{0}' has no sub-commands. (Maybe '{1}' is for a parameter?)",
"worldedit.help.subcommand-not-found": "The sub-command '{0}' under '{1}' could not be found.",
diff --git a/worldedit-fabric/build.gradle.kts b/worldedit-fabric/build.gradle.kts
index be85099fa..4b7a7b079 100644
--- a/worldedit-fabric/build.gradle.kts
+++ b/worldedit-fabric/build.gradle.kts
@@ -7,8 +7,8 @@ applyShadowConfiguration()
apply(plugin = "fabric-loom")
val minecraftVersion = "1.15.2"
-val yarnMappings = "1.15.2+build.8:v2"
-val loaderVersion = "0.7.6+build.180"
+val yarnMappings = "1.15.2+build.14:v2"
+val loaderVersion = "0.7.8+build.189"
configurations.all {
resolutionStrategy {
@@ -61,16 +61,12 @@ tasks.named