Skip to content

Commit

Permalink
fix: lava can't be contained
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Dec 28, 2024
1 parent 3e884fe commit e8086fd
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ protected boolean flowInto(Dimension dimension, Vector3ic src, BlockState liquid
return true;
}

var canContainLiquid = existing.getBlockStateData().canContainLiquid();
var canContainLiquid =
// We can't flow into if the liquid cannot be contained (e.g. lava)
canBeContained() &&
// We can't flow into if the existing block can't contain liquid
existing.getBlockStateData().canContainLiquid();
if (canContainLiquid) {
if (getLiquidInWorld(dimension, pos).right() != null) {

Check warning on line 235 in server/src/main/java/org/allaymc/server/block/component/BlockLiquidBaseComponentImpl.java

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

server/src/main/java/org/allaymc/server/block/component/BlockLiquidBaseComponentImpl.java#L235

These nested if statements could be combined
// We've got a liquid displacer, and it's got a liquid within it, so we can't flow into this.
Expand All @@ -236,7 +240,7 @@ protected boolean flowInto(Dimension dimension, Vector3ic src, BlockState liquid

var liquidReactionOnTouch = existing.getBlockStateData().liquidReactionOnTouch();
var removedOnTouch = liquidReactionOnTouch.removedOnTouch();
if (!removedOnTouch && (!canContainLiquid || !canContainSpecificLiquid(existing.getBlockStateData(), getLiquidBlockState(newDepth, falling)))) {
if (!(existing.getBlockType() == BlockTypes.AIR || removedOnTouch) && (!canContainLiquid || !canContainSpecificLiquid(existing.getBlockStateData(), getLiquidBlockState(newDepth, falling)))) {
// Can't flow into this block.
return false;
}
Expand Down

0 comments on commit e8086fd

Please sign in to comment.