Skip to content

BowSpell

MomoPewpew edited this page Jul 28, 2023 · 17 revisions

Source Code

spell-class: ".BowSpell"

Description:

A spell that fires when a player shoots a bow or crossbow. Options exist for casting a spell on shooting, hitting an entity or hitting a block.

Configuration Options:

Option Description Default Value
bindable Whether the bow spell can be bound to an item. false
bow-name When defined, only bows with names that match this value exactly can trigger the bow spell. -
bow-names When defined, only bows with names contained in this list can trigger the bow spell. -
bow-items When defined, only bows that match one of the listed items (using the Cast Items format) can trigger the spell. -
can-trigger Target list players
cancel-shot-on-fail When true, if the bow spell fails to cast, the bow's arrow shot is cancelled. true
cancel-shot Cancels the bow's arrow shot if the bow spell successfully casts. true
deny-offhand If true, the bow spell will not be cast if the arrow is being shot from a bow in the offhand. false
disallowed-bow-names When defined, any bows with names contained in this list cannot trigger the bow spell. -
disallowed-bow-items When defined, only bows that do not match one of the list items (using the Cast Items format) can trigger the spell. This option takes precedence over the option bow-items. -
ammo-items When defined, only ammo (items used to fire a projectile) that match one of the listed magic items can trigger the spell. The option takes a list of strings, with the strings being magic items. -
disallowed-ammo-items When defined, only ammo (items used to fire a projectile) that do not match one of the list magic items can trigger the spell. This option takes precedence over the option ammo-items. -
maximum-force Maximum force (how far the bow is pulled back) for the bow spell to trigger. Ranges from 0.0 to 1.0 1.0
minimum-force Minimum force (how far the bow is pulled back) for the bow spell to trigger. Ranges from 0.0 to 1.0 0.0
remove-arrow Removes the arrow associated with a bow spell after casting spells from hitting the ground or an entity. false
require-bind Requires bow spell to be bound to be cast. false
spell-on-hit-entity Sub-spell cast when the arrow associated with the bow spell hits an entity. -
spell-on-hit-entity-location Sub-spell cast when the arrow associated with the bow spell hits an entity, firing at the location the arrow hits the entity. For example, if the arrow hits the head of a zombie, the spell provided will be cast at the zombie's head. Must be a targeted spell that can hit the ground. -
spell-on-hit-ground Sub-spell cast when the arrow associated with the bow spell hits a block. -
spell Sub-spell casted when the bow is initially shot. -
use-bow-force Uses the bow's force when shot as the power for the spells being cast. 0.0 force translates to 0.0 power; 1.0 force translates to 1.0 power. Spells by default have 1.0 power. true

Examples:

frost-shot:
    spell-class: ".BowSpell"
    name: "FrostShot"
    bindable: true
    cancel-shot: false
    require-bind: true
    remove-arrow: true
    cancel-shot-on-fail: false
    spell-on-hit-entity: frost-shot-slow(mode=full)
    effects:
        trail:
            position: projectile
            effect: effectlibentity
            effectlib:
                class: ParticleEffect
                particle: snowball
                particle_count: 2
                iterations: 50
                period: 2

frost-shot-slow:
    spell-class: ".targeted.PotionEffectSpell"
    helper-spell: true
    type: slowness
    strength: 5
    duration: 100
    targeted: true
    str-cast-self: "Your shot has frozen your enemy!"
bow:
    spell-class: ".BowSpell"
    bow-names:
        - "Bow Of Volley"
        - "Bow Of Volley2"
    cooldown: 1
    cancel-shot: false
    use-bow-force: true
    cancel-shot-on-fail: false
    str-modifier-failed: "Modifiers failed!"
    minimum-force: 0.5
    spell: EFF_ARROW
    spell-on-hit-ground: ARROW_GROUND
    spell-on-hit-entity: ARROW_ENTITY
    modifiers:
        - sneaking required
    target-modifiers:
        - entitytype pig required
    location-modifiers:
        - inblock grass_block required
EFF_ARROW:
    spell-class: ".instant.DummySpell"
    effects:
        eff1:
            position: caster
            effect: effectlib
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                particleSize: 0.8
                color: ffff00
                iterations: 20
                period: 3
                radius: 1.25
                particles: 40
                visibleRange: 60
ARROW_ENTITY:
    spell-class: ".targeted.DummySpell"
    effects:
        eff1:
            position: target
            effect: effectlibentity
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                particleSize: 0.8
                color: 00ff00
                iterations: 20
                period: 3
                radius: 1.25
                particles: 40
                visibleRange: 60
ARROW_GROUND:
    spell-class: ".targeted.DummySpell"
    effects:
        eff1:
            position: target
            effect: effectlib
            effectlib:
                class: SphereEffect
                particle: REDSTONE
                particleSize: 0.8
                color: 00ffff
                iterations: 20
                period: 3
                radius: 1.25
                particles: 40
                visibleRange: 60
Clone this wiki locally