mojira.dev
MC-250034

Standing on top of mud as it converts to clay causes the player to fall through or be pushed out of the block

Relates to MC-120611

The bug

If the player (or probably any other entity) is standing on top of a mud block as soon as that mud block becomes clay via the dripstone mechanic, the player will fall into the clay block. If there are no blocks around that clay block, this can additionally cause them to be pushed out of it sideways.

How to reproduce

  1. Place mud

  2. Place a block below the mud

  3. Place a stalactite below the block

  4. Stand on the mud

  5. Wait or set randomTickSpeed to a high value

Expected results

As the mud converts to clay, the player would be moved upwards slightly to accommodate the clay block's hitbox, as is done for farmland that becomes dirt.

Actual results

The player is not moved upwards and falls into the clay as a result.

Code analysis

Code analysis by @unknown can be found in this comment.

Related issues

Attachments

Comments

migrated
[media][media][media][media][media][media]
Avoma

Can confirm in 22w16b. This could be fixed by calling the pushEntitiesUp() method where appropriate, just like how farmland does when it converts to dirt to avoid entities standing on top of it from "falling" into the ground.

Avoma

I can confirm this behavior in 1.19 Pre-release 3. Here's a code analysis regarding this issue.

Code Analysis:

The following is based on a decompiled version of Minecraft 1.19 Pre-release 3 using Mojang mappings.

net.minecraft.world.level.block.PointedDripstoneBlock.java

public class PointedDripstoneBlock extends Block implements Fallable, SimpleWaterloggedBlock {
   ...
   public static void maybeTransferFluid(BlockState blockState, ServerLevel serverLevel, BlockPos blockPos, float f) {
      ...
      Optional<FluidInfo> optional = PointedDripstoneBlock.getFluidAboveStalactite(serverLevel, blockPos, blockState);
      ...
      if (optional.get().sourceState.is(Blocks.MUD) && fluid == Fluids.WATER) {
         BlockState blockState2 = Blocks.CLAY.defaultBlockState();
         serverLevel.setBlockAndUpdate(optional.get().pos, blockState2);
         serverLevel.gameEvent(GameEvent.BLOCK_CHANGE, optional.get().pos, GameEvent.Context.of(blockState2));
         serverLevel.levelEvent(1504, blockPos2, 0);
         return;
      }
      ...

If we look at the above class, we can see that when mud converts into clay, the pushEntitiesUp() method (a method responsible for pushing entities upwards) is never called throughout the piece of code, resulting in entities sinking into blocks shortly after mud converts into clay.

muzikbike

gegy

Confirmed

Low

Block states

22w14a, 22w15a, 22w16b, 22w18a, 1.19 Pre-release 3

1.19 Pre-release 5

Retrieved