Forging Table

Forging Table

Forging Table is an addon that introduces players a new forging mechanic that similar to an anvil or smithing table, but it is very easy for developers to customize with disenc...

ModMC 1.21.80 – 1.21.90Updated 1 years ago
kam!ikam!i14 items

Screenshots

Forging Table — screenshot 1
Forging Table — screenshot 2
Forging Table — screenshot 3
Forging Table — screenshot 4

Description

Forging Table is an addon that introduces players a new forging mechanic that similar to an anvil or smithing table. Still, it is very easy for developers to customize with disenchanting weapon ability.

Forging Table UI Panel


Forging Table Recipe


Features:

  • Forging Table API

  • Built-in disenchanting ability

  • Built-in curse-removing ability


Compatibility

If you are an addon developer who wants to add your custom forging table recipe, you can do it by copying the forging table module to your addon script folder from this behavior pack in the folder "scripts/module/ForgingTableModule.js".

Example code:

scripts/disenchant.js

import { ForgingTableModule } from "./module/ForgingTableModule";
import { ItemStack } from "@minecraft/server";

ForgingTableModule.registerForgingRecipe(
    {
        primary: {
            tag: [ "minecraft:is_tool", "minecraft:is_armor"]
        },
        secondary: {
            item: [ "minecraft:book", "minecraft:enchanted_book" ]
        },
        tool: {
            item: "minecraft:echo_shard"
        },
        cost: 4
    },
    data =>{
        let enchantable = data.result.getComponent("minecraft:enchantable");
        if(enchantable && data.secondary && data.secondary.amount == 1){
            let enchantments = enchantable.getEnchantments();
            if(enchantments.length > 0 && !enchantable.hasEnchantment("binding") && !enchantable.hasEnchantment("vanishing")){
                let book_enchantable = data.secondary.getComponent("minecraft:enchantable");
              if(!book_enchantable.hasEnchantment(enchantments[0].type)){
                    let out_book = new ItemStack("minecraft:enchanted_book");
                    out_book.getComponent("minecraft:enchantable").addEnchantments(book_enchantable.getEnchantments().concat(enchantments[0]));
                    data.secondary = out_book;
                    enchantable.removeEnchantment(enchantments[0].type);
                    if(data.tool.amount > 1){
                        data.tool.amount -= 1;
                    }else{
                        data.tool = undefined;
                    }
                    data.primary = undefined;
                }else{
                    data.cancel = true;
                }
            }else{
                data.cancel = true;
            }
        }else{
            data.cancel = true;
        }
    }
)

Download Files

Forging Table Resource v1.011 KB.mcpack

Required packs (install with the main file)

Forging Table Behavior v1.016 KB.mcpack
Source: MCPEDL · by kam!i · CurseForge