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

"replace_block" enchantment effect doesn't work in certain circumstances

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.21 Pre-Release 1, 1.21 Pre-Release 4
    • None
    • Confirmed
    • Data Packs, Enchantments
    • Normal
    • Platform

      If you have an enchantment like the JSON file below, where the "replace block" effect is called after hitting a block, the changes made by this effect will be completely overridden by air if the block you hit can be broken instantly.

      Steps to reproduce the issue

       

      1. Download the provided datapack, or create an enchantment in a datapack under the "data/harvest/enchantment/till.json" path:

       
       

      {
        "anvil_cost": 5,
        "description": {
          "translate": "enchantment.harvest.till"
        },
        "effects": {
          "minecraft:hit_block": [
            {
              "effect": {
                "type": "minecraft:replace_block",
                "block_state": {
                  "type": "simple_state_provider",
                  "state": {
                    "Name": "minecraft:bedrock"
                  }
                }
              }
            }
          ]
        },
        "max_cost": {
          "base": 65,
          "per_level_above_first": 9
        },
        "max_level": 3,
        "min_cost": {
          "base": 15,
          "per_level_above_first": 9
        },
        "primary_items": "#minecraft:hoes",
        "slots": [
          "mainhand"
        ],
        "supported_items": "#minecraft:hoes",
        "weight": 4
      }

       

      2. Give yourself a hoe and enchant it with the enchantment (harvest:till) using the /enchant command.

      3. Try to hit any block that can be broken instantly, such as grass, crops, torches, etc.

      Behavior

      Current behavior: The block hit will break.

      Expected behavior: The block hit will be replaced by bedrock.

      Note:

      Hitting any other block with the enchantment will replace it with bedrock, as expected.

       

            Unassigned Unassigned
            Manchick Manchick
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              CHK: