AgaCore Only Tool Destructible

AgaCore Only Tool Destructible

A Bedrock script component that enforces tool-based block breaking rules with tier checks, Silk Touch logic, custom loot, and durability handling.

ModScriptUpdated 1 years ago
AgaCraftAgaCraft11 items

Description

🇺🇸 English

Need blocks that can only be broken using the correct tool? This script adds a custom aga:only\_tool\_destructible component that checks tool type, tool tier, block tier, Silk Touch conditions, and optional loot definitions before allowing the block to break.

Features:

  • Custom block component: aga:only\_tool\_destructible.

  • Requires the correct tool type (pickaxe, axe, shovel, hoe, sword, shears, mace).

  • Enforces tier requirements between block and tool.

  • Full Silk Touch support:

    • ignore\_tool: allows Silk Touch to work even with the wrong tool.

    • loot: custom loot table for Silk Touch.

  • Supports custom loot without Silk Touch.

  • Applies correct durability damage (with Unbreaking support).

  • Cancels block breaking if requirements aren’t met.


🧩 Component Structure

Your block can provide the following configuration:

{
    silk_touch?: {
        ignore_tool?: boolean; // Allows Silk Touch to bypass tool checks
        loot?: string;         // Loot table used when Silk Touch applies
    };
    loot?: string;             // Loot table used when the tool is valid
}

📦 Example: JSON block definition using this component

{
  "format_version": "1.21.40",
  "minecraft:block": {
    "description": {
      "identifier": "example:steel_ore"
    },

    "components": {
      "minecraft:destructible_by_explosion": { "explosion_resistance": 10 },
      "minecraft:destructible_by_mining": { "seconds_to_destroy": 4 },
      "minecraft:is_pickaxe_item_destructible": {},
      "minecraft:iron_tier_destructible": {},

      // 👇 Your custom component
      "aga:only_tool_destructible": {
        "silk_touch": {
          "ignore_tool": true,
          "loot": "loot_tables/blocks/steel_ore_silk_touch.json"
        },
        "loot": "loot_tables/blocks/steel_ore.json"
      }
    }
  }
}

If:

  • The correct tool and tier are used → block drops steel_ore.json

  • Silk Touch is used → drops steel_ore_silk_touch.json

  • Wrong tool is used → block breaks but drops nothing, and the tool takes durability damage.


🇲🇽 Español

¿Quieres que algunos bloques solo puedan romperse con la herramienta correcta? Este script añade un componente personalizado aga:only_tool_destructible que valida el tipo de herramienta, el nivel del tier, Silk Touch y loot personalizado antes de permitir que el bloque se rompa.

Características:

  • Componente personalizado: aga:only\_tool\_destructible.

  • Exige el tipo correcto de herramienta. (pico, hacha, pala, azada, espada, tijeras, maso).

  • Comprueba nivel del bloque vs nivel de la herramienta.

  • Soporte completo para Toque de seda:

    • ignore\_tool: permite usar Toque de seda aunque no sea la herramienta correcta.

    • loot: loot especial para Toque de seda.

  • Soporta loot personalizado sin Toque de seda.

  • Calcula daño de durabilidad (Soporta Irrompibilidad).

  • Cancela el drop si no se cumplen las condiciones.


🧩 Estructura del componente

Tu bloque debe seguir la siguiente configuración:

{
    silk_touch?: {
        ignore_tool?: boolean; // Permite que Toque de seda ignore otras herramientas
        loot?: string;         // Loot con toque de seda
    };
    loot?: string;             // Loot con herramienta valida
}

📦 Ejemplo: JSON del bloque usando este componente

{
  "format_version": "1.21.40",
  "minecraft:block": {
    "description": {
      "identifier": "example:steel_ore"
    },

    "components": {
      "minecraft:destructible_by_explosion": { "explosion_resistance": 10 },
      "minecraft:destructible_by_mining": { "seconds_to_destroy": 4 },
      "minecraft:is_pickaxe_item_destructible": {},
      "minecraft:iron_tier_destructible": {},

      // 👇 Componente personalizado
      "aga:only_tool_destructible": {
        "silk_touch": {
          "ignore_tool": true,
          "loot": "loot_tables/blocks/steel_ore_silk_touch.json"
        },
        "loot": "loot_tables/blocks/steel_ore.json"
      }
    }
  }
}

📌

  • Si usas la herramienta correcta → suelta steel_ore.json

  • Si usas Toque de seda → suelta steel_ore_silk_touch.json

  • Si usas herramienta incorrecta → se rompe pero sin loot y con daño de herramienta

Download Files

AgaCore-OnlyToolDestructible607 KB.mcpack
Source: MCPEDL · by AgaCraft · CurseForge