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

The "mobGriefing" gamerule doesn't prevent burning entities from being able to decrease the levels of water or powder snow cauldrons

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.18.1, 22w06a, 22w07a, 1.18.2 Pre-release 1, 1.18.2, 22w14a, 22w17a, 1.19, 1.19.1, 1.19.2, 22w45a, 1.19.3, 1.19.4, 1.20.1, 23w33a, 1.20.2, 1.21, 1.21.3, 24w45a
    • Confirmed
    • Block states, Mob behaviour
    • Low
    • Platform

      The Bug:

      The "mobGriefing" gamerule doesn't prevent burning entities from being able to decrease the levels of water or powder snow cauldrons.

      The "mobGriefing" gamerule is supposed to prevent mobs from being able to interact with the environment around them, however, this doesn't prevent burning entities from being able to decrease the levels of water or powder snow cauldrons.

      Steps to Reproduce:

      1. Place down a cauldron and fill it with some water or powder snow.
      2. Set the "mobGriefing" gamerule to "false" by using the command provided below.
        /gamerule mobGriefing false
      3. Set the time to "day", stand inside of the cauldron, and summon a skeleton at your position by using the command provided below.
        /summon minecraft:skeleton ~ ~ ~
      4. Wait around ten seconds and watch the filled cauldron closely.
      5. Take note as to whether or not the "mobGriefing" gamerule prevents burning entities from being able to decrease the levels of water or powder snow cauldrons.

      Observed Behavior:

      The "mobGriefing" gamerule doesn't prevent burning entities from being able to decrease the levels of water or powder snow cauldrons.

      Expected Behavior:

      The "mobGriefing" gamerule would prevent burning entities from being able to decrease the levels of water or powder snow cauldrons.

      Code Analysis:

      Code analysis by Avoma can be found below.

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

      net.minecraft.world.level.block.LayeredCauldronBlock.java
      public class LayeredCauldronBlock extends AbstractCauldronBlock {
         ...
         public void entityInside(BlockState blockState, Level level, BlockPos blockPos, Entity entiity) {
            if (!level.isClientSide && entity.isOnFire() && this.isEntityInsideContent(blockState, blockPos, entity)) {
               entity.clearFire();
               if (entiity.mayInteract(level, blockPos)) {
                  this.handleEntityOnFireInside(blockState, level, blockPos);
               }
            }
      
         }
         ...

      If we look at the above class, we can see that there is only one check that is carried out in terms of the filled cauldron block, before allowing it to be decreased by burning entities. This check is to see if the mob can interact with the filled cauldron. The game doesn't check what the "mobGriefing" gamerule is set to before allowing burning entities to be able to decrease the levels of water or powder snow cauldrons, therefore resulting in this problem occurring.

      Fix:

      Simply altering the appropriate existing "if" statement within this piece of code to check what the "mobGriefing" gamerule is set to before allowing burning entities to be able to decrease the levels of water or powder snow cauldrons, will resolve this problem.

      Current "if" statement:
      if (entiity.mayInteract(level, blockPos))
      Fixed "if" statement:
      if (entity.mayInteract(level, blockPos) && level.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING))

        1. MC-248588.mp4
          4.96 MB
          [Mod] Avoma
        2. MC-248588.png
          3.94 MB
          [Mod] Avoma
        3. MC-248588 - Current Code.png
          28 kB
          [Mod] Avoma
        4. MC-248588 - Fixed Code.png
          32 kB
          [Mod] Avoma

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

              Created:
              Updated:
              CHK: