Skip to content
Crogoze edited this page Dec 25, 2022 · 22 revisions

Bow Spell

Source Code

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 a list of magic items to match for bows with names contained in this list can trigger the bow spell. -
can-trigger List of valid entity types that can trigger the bow spell. Can be either a string list or a string with the items separated by a comma. Valid types: self or caster, player or players, invisible or invisibles, nonplayer or nonplayers, monster or monsters, animal or animals, entity type. 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 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. -
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 casted. false
spell-on-hit-entity Spell casted when the arrow associated with the bow spell hits an entity. -
spell-on-hit-entity-location Spell casted 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 casted at the zombie's head. Must be a targeted spell that can hit the ground. -
spell-on-hit-ground Spell casted when the arrow associated with the bow spell hits a block. -
spell 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 casted. 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