Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-6125

Trying to place a bed on a grass path breaks the grass path when BlockPlace is cancelled

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • git-Spigot-b5a13e6-e23c81c (MC: 1.16.2) (Implementing API version 1.16.2-R0.1-SNAPSHOT)
    • Yes

      When you are trying to place a bed on a grass path block, that block gets replaced by dirt even if the placement is cancelled.

      This happens because trying to place the bed triggers a block update (tickAlways) for the grass path and grass path always decays when this happens. other blocks (for example farmland) have a check if they are valid any only decay if this is not the case, but the grass path is missing that check.

      Farmland (and other blocks):

      public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
              if (!iblockdata.canPlace(worldserver, blockposition)) {
                  fade(iblockdata, worldserver, blockposition);
              }
          }

      Grass path:

          public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) {
              BlockSoil.fade(iblockdata, worldserver, blockposition);
          }
      

      See here for details and the analysis of this bug: https://github.com/PaperMC/Paper/issues/4242

      PR: https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/pull-requests/750/overview

            Unassigned Unassigned
            Brokkonaut Brokkonaut
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: