Skip to content

Fixed respawn anchor explode blocks underwater#6929

Open
b1zeyofficial wants to merge 8 commits intopmmp:minor-nextfrom
b1zeyofficial:respawn-anchor-underwater
Open

Fixed respawn anchor explode blocks underwater#6929
b1zeyofficial wants to merge 8 commits intopmmp:minor-nextfrom
b1zeyofficial:respawn-anchor-underwater

Conversation

@b1zeyofficial
Copy link
Contributor

@b1zeyofficial b1zeyofficial commented Dec 7, 2025

As per title

Related issues & PRs

Behavioural changes

i think the servers behavior shouldnt change, but need to check

Tests

https://www.youtube.com/watch?v=FK-LLQQMVEo

@b1zeyofficial b1zeyofficial requested a review from a team as a code owner December 7, 2025 09:41
}
}
return false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this checking the down face?

Copy link
Contributor Author

@b1zeyofficial b1zeyofficial Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to have forgotten that the Java code checks for water under each horizontal block, since the existing code is similar to vanilla behavior.

P.S:
Apparently we should only check for horizontal blocks and not the Respawn Anchor itself, im confused

	private static boolean isWaterThatWouldFlow(BlockPos blockPos, Level level) {
		FluidState fluidState = level.getFluidState(blockPos);
		if (!fluidState.is(FluidTags.WATER)) {
			return false;
		} else if (fluidState.isSource()) {
			return true;
		} else {
			float f = fluidState.getAmount();
			if (f < 2.0F) {
				return false;
			} else {
				FluidState fluidState2 = level.getFluidState(blockPos.below());
				return !fluidState2.is(FluidTags.WATER);
			}
		}
	}
	
	private void explode(BlockState blockState, Level level, BlockPos blockPos) {
		level.removeBlock(blockPos, false);
		boolean bl = Direction.Plane.HORIZONTAL.stream().map(blockPos::relative).anyMatch(blockPosx -> isWaterThatWouldFlow(blockPosx, level));

@dktapps dktapps added Category: Gameplay Related to Minecraft gameplay experience Type: Fix Bug fix, typo fix, or any other fix Status: Waiting on Author labels Dec 8, 2025
@b1zeyofficial
Copy link
Contributor Author

It doesnt really mimic vanilla behavior, for example, when water flows and a respawn anchor is placed in place, it doesnt explode blocks like it does in vanilla. Can we measure the fluidity of water using the Liquid->getDecay method?

@dktapps
Copy link
Member

dktapps commented Dec 19, 2025

Yes, but decay is opposite to the fluid height. 0 is source, 7 is the shallowest.

@b1zeyofficial
Copy link
Contributor Author

everything remained the same, only the style changed and a couple of changes, it seems like I check that decay >= 1 but it still explodes after only 2 streams, maybe I miscalculated somewhere?
I also removed instanceof Liquid because we dont want lava to be able to somehow muffle the anchor's explosion, do we?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Category: Gameplay Related to Minecraft gameplay experience Type: Fix Bug fix, typo fix, or any other fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants