#New Hephaestus tool type - Item must be "IModifiable" object

3 messages · Page 1 of 1 (latest)

smoky rover
#

I'm trying to add a new type of weapon to Hephaestus, a fabric port of Tinkers Construct. The standard Tinkers way of doing this doesn't seem to be available on Fabric, so I've turned to KubeJS, which I am very new to.

The main problem I'm having: Hephaestus tools need to belong to the IModifiable class from that mod, so they can have different stats and traits. I'm registering an item in a startup script but do not know how to make it an IModifiable.

If it helps, here is the link what I think is the relevant code in Hephaestus: https://github.com/Alpha-s-Stuff/TinkersConstruct/blob/1.20.1/src/main/java/slimeknights/tconstruct/library/tools/item/IModifiable.java

GitHub

Tinker a little, build a little, tinker a little more... - Alpha-s-Stuff/TinkersConstruct

brittle folioBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

smoky rover
#

okay, after a lot of trouble, this is what i got working
(note for anyone who may stumble upon this post: you also still need to define some tool stuff in a datapack. the SlimeKnights documentation is thankfully very helpful)

const ModifiableItem = Java.loadClass('slimeknights.tconstruct.library.tools.item.ModifiableItem')
const Properties = Java.loadClass('java.util.Properties')
const TinkerTabs = Java.loadClass('slimeknights.tconstruct.common.TinkerTabs')
const ToolDefinition = Java.loadClass('slimeknights.tconstruct.library.tools.definition.ToolDefinition')

StartupEvents.registry('item', event => {
    event.createCustom('my_datapack:my_tool', () => new ModifiableItem(
        new FabricItemSettings().stacksTo(1),
        ToolDefinition.builder("my_datapack:my_tool").meleeHarvest().build(),
        TinkerTabs.TAB_TOOLS
    ))
})```