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

Some Entities get stuck in upwards (soul sand) bubble columns

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • Minecraft 1.13.1, 1.15 Pre-Release 2, 1.16.4, 20w49a, 20w51a, 21w03a, 1.16.5, 21w05b, 21w06a, 21w08b, 21w15a, 1.18.1, 1.19.4, 23w12a, 1.20.2, 23w43b
    • Community Consensus
    • Entities
    • Normal
    • Platform

      The bug:

      Tnt, Falling blocks, and Xp orbs (only those that I know of currently, might be more) can get stuck in up going (soul sand) bubble columns. This is due to the order or events in the entities tick phase where the onGround tag perpetuates downward motion instead of upwards due to being in the column. (Watch video to understand better)

      Example: https://youtu.be/drtWuTpykA4

      The Setup:

      Build the following:

      (WARNING!! IT WILL EXPLODE BETWEEN TNT. YOU MUST REBUILD IT WHEN TESTING THE OTHER TNT) 

      Fire the Tnt one at a time to see the issue. 

      You can use the following command a few blocks above the soul sand to test xp orbs.

      /summon minecraft:experience_orb ~ ~8 ~ {Motion:[0.0,-9.0,0.0]}
      

      Code Analysis:

      Using 20w49a yarn/fabric mappings:

      We will be looking at the Tnt entity for this:

      public class TntEntity
      //remove code
      public void tick() {
          if (!this.hasNoGravity()) {
              this.setVelocity(this.getVelocity().add(0.0, -0.04, 0.0));
          }
          this.move(MovementType.SELF, this.getVelocity());
          this.setVelocity(this.getVelocity().multiply(0.98));
          if (this.onGround) {
              this.setVelocity(this.getVelocity().multiply(0.7, -0.5, 0.7));
          }
         //remove code 
      }
      

      Here, we have the tick method of Tnt. For this, let us assume that the Tnt has enough downward motion to reach the soul sand of the bubble column (lets say -10.0 b/gt)

      First we will add gravity to the motion making it -10.04 b/gt.

      Next we will do a move method.

      Without showing the code, what will happen is that it will collide with the soul sand, set it's velocity to 0 b/gt and set onGround to true then check more block collisions, in this case, bubble column. From 0 b/gt, it will set the velocity to 0.7 b/gt from the "onBubbleColumnCollision" method in the entity class.

      Thirdly, (back in the Tnt tick method) we will multiply all axis motion by 0.98 (drag), thus making the y motion now 0.686 b/gt. 

      Fourthly, as onGround was set to true by the move method, it will multiple the Y axis by -0.5, thus making the velocity -0.343 b/gt

      As we end up with a negative velocity, the onGround will be set to true in the next move method as it will collide with the soul sand and the cycle will continue. This makes the bubble column not work.

      A Potential Fix:

      If an entity has collided with a bubble column in the "checkBlockCollision()", set the OnGround tag to False. This may have unforeseen consequences, but I can't think of any as of now

       

            Unassigned Unassigned
            Kman032317 Kyle Weber
            Votes:
            28 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:
              CHK: