mojira.dev
MC-226875

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

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"
  }
}
{
  "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
tellraw @s "Stone"
advancement revoke @s only stone
  1. 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());
    }
}
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.

Comments 4

This seems like a feature request. The advancement likely uses the "block" field as there are no other blocks in the game which function as bee hives/bee nests.

There are two unrelated things mentioned in this issue:

  1. The block field can only specify bee_nest or beehive, other blocks doesn't trigger. <- Can confirm in 1.20.2.

  2. The block field can use but does not use the blocks predicate. <- Can't confirm in 1.20.2. (the log showed "Unknown advancement"

The first one is definitely a bug showing the inconsistency between the name, field, and its functionality. But the other is just invalid since this field was added and broken before the blocks predicate was added (can confirm in 1.15.2

As the reporter has been inactive for 2 years, I would request ownership to make this issue clear.

But it’s normal, not a bug /:|

Irony

ccJerrycc

(Unassigned)

Community Consensus

Advancements

1.17 Pre-release 1, 1.17 Release Candidate 1, 1.20.2

Retrieved