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

Pistons breaking blocks yields no drops

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 24w10a
    • None
    • Community Consensus
    • (Unassigned)

      Steps to reproduce:

      Create a setup like in fig1.png

      Run /tick freeze

      Break the redstone block followed by the piston head (the order is important)

      Place a piston against the oak planks so it faces downwards

      Compare your setup to fig2.png

      Run /tick unfreeze

      Compare your setup to fig3.png

       

      Observed behavior:

      The block below the piston breaks but doesn't drop anything

       

      Expected behavior:

      The block below the piston breaks and drops a block according to the rules of /setblock <coordinates> air destroy

       

      Suggested fix:

      On a piston retraction if the block in front of the base is a minecraft:pison_head do nothing and continue to retraction logic,

      Otherwise, break the block in front of the base rather than setting it to air

       

      Java-like pseudocode:

      public class PistonBase {
          public void onRetract() {
              // If the block is a piston head, do nothing
              if(this.getBlockInFront() instanceof PistonHead)
                  this.getBlockInFront().getLocation().getBlock(AIR);
              // If the block is not a piston head, break it
              else
                  this.getBlockInFront().getLocation().destroy();
              // The rest of the logic in this function
          }
      }
       

        1. fig1.png
          826 kB
          John Doe
        2. fig2.png
          936 kB
          John Doe
        3. fig3.png
          952 kB
          John Doe

            Unassigned Unassigned
            Player_X_YT John Doe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: