Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-247234

Splash and bubble particles produced when coming into contact with flowing water are displayed slightly too high

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.18.1, 22w03a, 22w05a, 22w06a, 22w07a, 1.18.2 Pre-release 1, 1.18.2, 22w11a, 22w13a, 22w17a, 22w18a, 1.19, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.20.1
    • None
    • Confirmed
    • Particles
    • Low
    • Platform

      The Bug:

      The splash and bubble particles produced when coming into contact with flowing water always act as if flowing water is a full block, meaning that they're occasionally produced in the air or slightly too high.

      Steps to Reproduce:

      1. Place down a bucket of water and allow it to spread.
      2. Switch into third person, walk into the flowing water, and pay close attention to how the splash and bubble particles are produced.
      3. Take note as to whether or not splash and bubble particles produced when coming into contact with flowing water are displayed slightly too high.

      Observed Behavior:

      The particles act as if flowing water is a full block meaning that they're occasionally produced too high.

      Expected Behavior:

      The particles would not treat flowing water as a full block, meaning that they would not be displayed too high.

      Code Analysis:

      Code analysis by Avoma can be found below.

      The following is based on a decompiled version of Minecraft 1.18.1 using MCP-Reborn.

      net.minecraft.world.entity.Entity.java
      public abstract class Entity implements Nameable, EntityAccess, CommandSource {
         ...
         protected void doWaterSplashEffect() {
            ...
            Vec3 vec3 = entity.getDeltaMovement();
            ...
      
            float f2 = (float)Mth.floor(this.getY());
      
            for(int i = 0; (float)i < 1.0F + this.dimensions.width * 20.0F; ++i) {
               double d0 = (this.random.nextDouble() * 2.0D - 1.0D) * (double)this.dimensions.width;
               double d1 = (this.random.nextDouble() * 2.0D - 1.0D) * (double)this.dimensions.width;
               this.level.addParticle(ParticleTypes.BUBBLE, this.getX() + d0, (double)(f2 + 1.0F), this.getZ() + d1, vec3.x, vec3.y - this.random.nextDouble() * (double)0.2F, vec3.z);
            }
      
            for(int j = 0; (float)j < 1.0F + this.dimensions.width * 20.0F; ++j) {
               double d2 = (this.random.nextDouble() * 2.0D - 1.0D) * (double)this.dimensions.width;
               double d3 = (this.random.nextDouble() * 2.0D - 1.0D) * (double)this.dimensions.width;
               this.level.addParticle(ParticleTypes.SPLASH, this.getX() + d2, (double)(f2 + 1.0F), this.getZ() + d3, vec3.x, vec3.y, vec3.z);
            }
            ...

      If we look at the above class, we can see that the "y" level of where splash and bubble particles are produced is determined by one block above the water's position. This is evident through the following line of code:

      (double)(f2 + 1.0F)

      As a result of this, in some cases, the particles can appear too high.

        1. MC-247234.mp4
          6.84 MB
        2. MC-247234.png
          MC-247234.png
          2.24 MB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: