RangedJS: KubeJS Addon
This KubeJS addon provides Minecraft pack developers with convenient tools for creating personalized bow weapons. The main advantage lies in the automatic registration of realistic bowstring pulling animation, which is missing from the basic KubeJS functionality.
Usage Example
StartupEvents.registry("item", event => {
event.create("test_bow", "bow").bow(bow => {
bow.modifyBow(attributes => {
attributes
.fullChargeTicks(40) //time to full charge is 40 ticks
.flamingArrow() //arrows are flaming by default
.baseDamage(5) //base damage is set to 5 (default is 2.0)
.power(1)
})
.onArrowHit(arrow => {
arrow.hitEntity(event => {
const {entity} = event
if(entity.type == "minecraft:villager"){
event.cancel() //arrow passes through villager without dealing damage
}
else{
entity.block.createEntity("minecraft:lightning_bolt").spawn()//creates lightning bolt when hitting entity
}
})
arrow.hitBlock(event => {
const {block} = event
if(block.id == "minecraft:tnt") event.cancel() //prevents tnt from being ignited by arrow
})
})
})
})
Development Plans
Future updates plan to expand functionality with crossbow support, as well as possible implementation of systems for firearms and energy beams.