-
New Feature
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
git-Spigot-1a3504a-dfa7583
-
Yes
Updating the BlockState of a Waterlogged block does not trigger a physics update like it does when one updates the BlockState of a water or lava block.
Consider a fluid block suspended in an unstable, un-flowing state by cancelling {{BlockFromToEvent}}s. One may force the fluid block to flow by manually placing a block adjacent to the fluid block (causing a physics update). Attempting to automate this process is the following code:
if (block.getType() == Material.WATER || block.getType() == Material.LAVA) { Levelled levelled = (Levelled) block.getBlockData(); levelled.setLevel(1); block.setBlockData(levelled); Bukkit.getScheduler().runTaskLater(PLUGIN, () -> { levelled.setLevel(0); block.setBlockData(levelled); }, 1); } else if (Util.isWaterlogged(block)) { Waterlogged waterlogged = (Waterlogged) block.getBlockData(); waterlogged.setWaterlogged(false); block.setBlockData(waterlogged); Bukkit.getScheduler().runTaskLater(PLUGIN, () -> { waterlogged.setWaterlogged(true); block.setBlockData(waterlogged); }, 1); }
The expected behavior is for the fluid block to begin to flow. Indeed, the code works perfectly for water blocks and lava blocks since changing the Levellable level causes a block update. However, the same concept when applied to Waterlogged blocks does not work: it simply does not flow, whereas manually placing an adjacent block does cause it to flow. Additionally, forcing updates via BlockState#update on both the Waterlogged block and all adjacent blocks fails to cause the Waterlogged block to flow. I do not believe this is expected behavior.
- is duplicated by
-
SPIGOT-5363 Setting a block waterlogged does not cause a physics update.
- Resolved