Skip to content

Developer API & Tags

FROSTYTRIX edited this page May 28, 2026 · 2 revisions

Developer Info (API & Tags)

Information for modders and pack makers who wish to extend or integrate with Fletcher's Trestle.

As of 2.0.0, the bow and arrow material system is fully data-driven — modpack makers can add new materials in JSON without writing any Java. See the Modpack Integration page (or MODPACK_INTEGRATION.md in the source) for the full reference.


🏷️ Item Tags

Use these tags to mark items as valid inputs for the fletching menu. A modpack adding a new material should extend the matching tag and ship a material def JSON (see Modpack Integration).

Tag Slot it gates
fletcherstrestle:bow_risers Riser slot
fletcherstrestle:bow_limbs Bow limb slot (pliable / steamed limbs)
fletcherstrestle:rough_limbs Arrow shaft slot (unsteamed limbs + sticks)
fletcherstrestle:bow_strings Bow string slot
fletcherstrestle:arrow_heads Arrow head slot
fletcherstrestle:arrow_fletching Arrow fletching slot

The tag controls whether the slot accepts the item at all. The material def's ingredient field controls which material id results from that input.


📦 Datapack Registries

Six datapack registries hold material definitions:

  • fletcherstrestle:bow_limb — at data/<pack>/fletcherstrestle/bow_limb/<id>.json
  • fletcherstrestle:bow_riser — at data/<pack>/fletcherstrestle/bow_riser/<id>.json
  • fletcherstrestle:bow_string — at data/<pack>/fletcherstrestle/bow_string/<id>.json
  • fletcherstrestle:arrow_head — at data/<pack>/fletcherstrestle/arrow_head/<id>.json
  • fletcherstrestle:arrow_shaft — at data/<pack>/fletcherstrestle/arrow_shaft/<id>.json
  • fletcherstrestle:arrow_fletching — at data/<pack>/fletcherstrestle/arrow_fletching/<id>.json

All six are synced to clients — modpacks must ship the datapack on both server and client.

Schema for each JSON: ingredient + stats + optional texture override + optional list of behaviors (effects). Full schemas in Modpack Integration.


🧩 Data Components

The mod uses custom Data Components to store assembly information on items:

  • fletcherstrestle:bow_assembly — stores limb, riser, and string ids plus a tuning float on a modular bow / crossbow.
  • fletcherstrestle:arrow_assembly — stores head, shaft, and fletching ids on a modular arrow.

Material ids in these components are stored as namespaced ResourceLocation strings (e.g. "fletcherstrestle:oak", "mypack:steel"). Legacy bare-path strings ("oak") and pre-2.0.0 display-form strings ("Dark Oak", "High Tension") resolve through a three-tier fallback for backward compatibility.

Other components used:

  • fletcherstrestle:quiver_selected_slot — int, current selected ammo slot on a quiver.
  • fletcherstrestle:max_quiver_slots — int, capacity of a quiver.
  • fletcherstrestle:bound_eagle — UUID, eagle bound to an Eagle Whistle.

🪄 Custom registry: MaterialEffectType

The effect vocabulary itself is extensible via a custom NeoForge registry. A companion mod can register new effect types:

public static final DeferredRegister<MaterialEffectType<?>> EFFECT_TYPES =
    DeferredRegister.create(
        net.frostytrix.fletcherstrestle.material.ModMaterialEffectTypes.REGISTRY_KEY,
        "mypack");

public static final Supplier<MaterialEffectType<MyCustomEffect>> MY_EFFECT =
    EFFECT_TYPES.register("my_effect",
        () -> new MaterialEffectType<>(MyCustomEffect.CODEC));

MyCustomEffect implements MaterialEffect and overrides whichever lifecycle hooks it cares about (seven hooks total — see Modpack Integration).


🪝 KubeJS bridge (no Java required)

Use the fletcherstrestle:scripted_callback effect type to attach script-side behavior to a material def:

const Callbacks = Java.loadClass(
    'net.frostytrix.fletcherstrestle.material.ScriptedEffectCallbacks');
const RL = Java.loadClass('net.minecraft.resources.ResourceLocation');

Callbacks.register(RL.parse('mypack:my_hit'), {
    onArrowHit: (arrow, hit) => { /* … */ }
});

Material JSON references it as { "type": "fletcherstrestle:scripted_callback", "id": "mypack:my_hit" }.


⚠️ Reserved id keywords

A handful of head behaviors are still Java-side (they need stateful coordination with the arrow's tick loop that the effect hooks can't express cleanly yet). The id strings below are reserved — a modpack can add a material with these ids, but the specific behavior will only fire if the stored id matches the built-in:

  • glass_vial (head) — potion splash
  • resonance_tip (head) — delayed echo damage
  • weighted_hook (head) — block-stick + shooter pull
  • trailing_rope (head) — drops block chain downward
  • vex (fletching) — phases through one block of cover
  • flax (string) — aim jitter on overdraw

Future API extensions may lift these into the effect system too. Until then, treat them as reserved.

Clone this wiki locally