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

Advancement trigger "bee_nest_destroyed" does only trigger when you break bee nest or beehive

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.17 Pre-release 1, 1.17 Release Candidate 1, 1.20.2
    • None
    • Community Consensus
    • Advancements

      The Bug

      Advancement trigger "bee_nest_destroyed" has a block condition not being able to specify any block that isn't a bee nest or beehive. This condition should be either removed for consistency or by adding compatibility for other block types.

      Steps to Reproduce

      1. Create an advancement using "bee_nest_destroyed" trigger with specified block field:
        data/test/advancements/stone.json
        {
          "criteria": {
            "requirement": {
              "trigger": "minecraft:bee_nest_destroyed",
              "conditions": {
                "block": "minecraft:stone"
              }
            }
          },
          "rewards": {
            "function": "test:stone"
          }
        }
        
        data/test/functions/stone.mcfunction
        tellraw @s "Stone"
        advancement revoke @s only stone
        
      2. Try to grant advancement in-game via task.

      Code Analysis

      I thought this was due to the wrong place of code (decompiled 1.20.2 using vanilla mapping:

      net.minecraft.world.level.block.Beehive.class
      public void playerDestroy(Level $$0, Player $$1, BlockPos $$2, BlockState $$3, @Nullable BlockEntity $$4, ItemStack $$5) {
          super.playerDestroy($$0, $$1, $$2, $$3, $$4, $$5);
          if (!$$0.isClientSide && $$4 instanceof BeehiveBlockEntity) {
              BeehiveBlockEntity $$6 = (BeehiveBlockEntity)$$4;
              ...
              CriteriaTriggers.BEE_NEST_DESTROYED.trigger((ServerPlayer)$$1, $$3, $$5, $$6.getOccupantCount());
          }
      }
      

      The "trigger" method invoked only if you destroyed a bee nest or beehive.

            Unassigned Unassigned
            ccJerrycc ccJerrycc
            Votes:
            4 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: