Skip to content

Commit

Permalink
Only freeze water source blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Aug 3, 2020
1 parent 97fb499 commit bb71efc
Showing 1 changed file with 5 additions and 2 deletions.
Expand Up @@ -34,6 +34,7 @@ public class SnowSimulator implements LayerFunction {
private final BlockState snowBlock = BlockTypes.SNOW_BLOCK.getDefaultState();

private final Property<Integer> snowLayersProperty = BlockTypes.SNOW.getProperty("layers");
private final Property<Integer> waterLevelProperty = BlockTypes.WATER.getProperty("level");

private final Extent extent;
private final boolean stack;
Expand Down Expand Up @@ -80,8 +81,10 @@ public boolean apply(BlockVector3 position, int depth) throws WorldEditException
BlockState block = this.extent.getBlock(position);

if (block.getBlockType() == BlockTypes.WATER) {
if (this.extent.setBlock(position, ice)) {
affected++;
if (block.getState(waterLevelProperty) == 0) {
if (this.extent.setBlock(position, ice)) {
affected++;
}
}
return false;
}
Expand Down

0 comments on commit bb71efc

Please sign in to comment.