Skip to content

Modpack Integration

FROSTYTRIX edited this page May 28, 2026 · 1 revision

Modpack Integration

2.0.0 makes the entire bow & arrow material system data-driven. Modpack makers can add new bow limbs, risers, strings, arrow heads, shafts, and fletchings — with their own stats and behaviors — purely in JSON. No companion mod required.

The canonical reference is MODPACK_INTEGRATION.md in the mod's source repo. This wiki page is a navigable summary.


At a glance

A "material" is one of six things. Each lives in its own datapack registry:

Slot Datapack folder
Bow limb data/<pack>/fletcherstrestle/bow_limb/<id>.json
Bow riser data/<pack>/fletcherstrestle/bow_riser/<id>.json
Bow string data/<pack>/fletcherstrestle/bow_string/<id>.json
Arrow head data/<pack>/fletcherstrestle/arrow_head/<id>.json
Arrow shaft data/<pack>/fletcherstrestle/arrow_shaft/<id>.json
Arrow fletching data/<pack>/fletcherstrestle/arrow_fletching/<id>.json

Each JSON has the same shape:

{
  "ingredient": { "tag": "c:ingots/steel" },
  "stats": { "damage_multiplier": 1.5 },
  "texture": "mypack:item/modular_bow/limbs/steel",
  "effects": [
    { "type": "fletcherstrestle:apply_effect",
      "effect": "minecraft:wither",
      "duration": 80,
      "amplifier": 1 }
  ]
}
  • ingredient — full vanilla Ingredient codec (item, tag, or list).
  • stats — typed per part. Schemas in MODPACK_INTEGRATION.md.
  • texture — optional override; falls back to a conventional path in the material's own namespace.
  • effects — optional list of declarative behaviors.

The effect vocabulary

19 built-in effect types cover everything the vanilla materials do:

On-hit damage modifiers (run BEFORE damage applies, on head/shaft/fletching defs):

  • damage_multiplier — flat scale
  • damage_multiplier_if_target_below_health — executioner (crimson shaft)
  • damage_multiplier_on_backstab — pale_oak shaft
  • damage_multiplier_by_distance — weighted_blunt head
  • damage_multiplier_if_target_armored — bodkin_point head
  • pierce_level — dark_oak shaft

On-hit side effects (after damage, on head/shaft/fletching):

  • apply_effect — broadhead bleed, mangrove slowness
  • heal_shooter — cherry shaft
  • pull_target_to_shooter — barbed_tip head
  • teleport_swap_with_target — warped shaft
  • drop_self_on_hit — bound fletching

Tick-time (every tick in flight, on head/shaft/fletching):

  • set_velocity_multiplier_at_tick — acacia shaft mid-flight boost
  • subtle_homing — serrated fletching magnetism

Block-hit (on head/shaft/fletching):

  • bounce_on_block — jungle shaft ricochet

Bow / crossbow release (on limb/riser/string):

  • ignite_arrow — crimson limb
  • set_arrow_no_gravity — warped limb
  • set_arrow_flag — spruce punch, copper conductive
  • apply_effect_to_shooter — acacia limb speed buff

Scripted escape hatch (any def):

  • scripted_callback — invokes a Java-side handler registered by id; KubeJS scripts or companion mods register the handler.

The full parameter list for each is in MODPACK_INTEGRATION.md → Effects reference.


End-to-end example: a Steel Spike arrow head

data/mypack/fletcherstrestle/arrow_head/steel_spike.json:

{
  "ingredient": { "tag": "c:ingots/steel" },
  "stats": { "damage_multiplier": 1.5 },
  "effects": [
    { "type": "fletcherstrestle:damage_multiplier_if_target_armored",
      "multiplier": 1.25 },
    { "type": "fletcherstrestle:apply_effect",
      "effect": "minecraft:wither",
      "duration": 80,
      "amplifier": 1 }
  ]
}

Pair it with a PNG at assets/mypack/textures/entity/projectiles/head/steel_spike.png and a lang entry "material.mypack.steel_spike": "Steel Spike".

Done. Steel ingots are now a valid head in the fletching menu, the arrow has 1.5× damage, +25% to armored targets, applies Wither II for 4 seconds on hit.


KubeJS scripts

Use the scripted_callback effect type to hook custom behavior from a KubeJS startup script:

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

Callbacks.register(RL.parse('mypack:wither_on_hit'), {
    onArrowHit: (arrow, hit) => {
        const target = hit.getEntity();
        if (target) target.addEffect(/* … */);
    }
});

Then reference "id": "mypack:wither_on_hit" in any material's effect list.

The handler object can override any of the seven lifecycle hooks (onArrowSpawn, onArrowTick, onPreArrowHit, onArrowHit, onArrowHitBlock, onBowRelease, onProjectileFired).


Java companion mods (extending the vocabulary)

If your behavior won't fit the existing vocabulary even with scripted_callback, you can register a brand-new MaterialEffectType in a small companion mod:

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

Your custom effect class implements MaterialEffect, overrides whichever lifecycle hooks it needs, and exposes a MapCodec for JSON parsing. Pack JSONs then reference "type": "mypack:my_effect".


What's still hardcoded

Five head behaviors retain their Java-side logic because they need stateful coordination with the arrow's tick loop that the simple effect hooks can't express cleanly. They're still reachable — a modpack can add new materials with the same id and the behavior will fire — but the id strings below are reserved keywords:

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

Sanity checklist

Adding a material to your pack:

  1. JSON at data/<pack>/fletcherstrestle/<part>/<id>.json
  2. Texture at assets/<pack>/textures/entity/projectiles/<part>/<id>.png
  3. Translation key material.<pack>.<id> in your lang file ✓
  4. Ingredient (single item / item list / tag) ✓
  5. Tag entry in the matching fletcherstrestle:<slot> tag so the fletching menu accepts the input ✓

Full reference in MODPACK_INTEGRATION.md.

Clone this wiki locally