SlashBlade JS
一个用于方便开发者使用 KubeJS 脚本编辑和创建 拔刀剑:重锋 的配方、并使用其事件的附属。
对模组缩写感到疑惑?这是有意为之
它能干什么?
对此,这里有一个现成的例子:
// priority: 0
// Server Side
// 当拔刀剑判定是否为魔化状态时,如果是非魔化状态,则消耗10耀魂值进入充能状态
SlashBladeJSEvents.powerBlade(event => {
let state = BladeState.of(event.blade)
let proudsoul = state.proudSoulCount
if (!event.isPowered() && proudsoul >= 10) {
state.setProudSoulCount(proudsoul - 10)
event.setPowered(true)
}
event.user.tell("ProudSoul: " + proudsoul) // 顺便告诉玩家当前耀魂值
})
// 这是一个自定义的拔刀剑配方
ServerEvents.recipes(event => {
event.recipes.slashblade.slashblade_shaped_recipe("slashblade:slashblade", [
"ABA",
"CSC",
"ABC"
], {
"S": SlashBladeIngredient.of(
SlashBladeRequestDefinition.name("slashblade:fox_black") // 前置刀要求
.killCount(233) // 杀敌数要求
.proudSoul(114514) // 耀魂数要求
.refineCount(10) // 精炼数要求
.addEnchantment(SBEnchantmentDefinition.of("minecraft:power", 2)) // 附魔要求
.build() // 别忘了.build()
),
"A": "minecraft:golden_apple", // 其他材料,就像写原版配方一样
"B": "#forge:bones",
"C": "minecraft:cake",
}, "slashblade:fox_white")
})
// 创建一把属于你的刀
ServerEvents.highPriorityData(event => {
let customBlade = SBSlashBladeDefinition.of("kubejs:test_blade", // 你的刀的ID
SBRenderDefinition.newInstance() // 渲染属性
.effectColor(2039347) // 设置刀光颜色(十六进制RGB转十进制)
.standbyRenderType(SBCarryType.DEFAULT) // 待命时位置
.modelName("kubejs:model/named/test_blade.obj") // ./kubejs/assets/kubejs/model/named/test_blade.obj
.textureName("kubejs:model/named/test_blade.png") // ./kubejs/assets/kubejs/model/named/test_blade.png
.build(), // 别忘了.build()
SBPropertiesDefinition.newInstance()
.maxDamage(666) // 最大耐久值
.baseAttackModifier(999) // 基础攻击力
.slashArtsType("slashblade:void_slash") // 设置特殊攻击(Special Attack)
.addSpecialEffect("slashblade:wither_edge") // 增加特殊效果(Special Effect)
.defaultSwordType([SBSwordType.FIERCEREDGE, SBSwordType.BEWITCHED]) // 设置刀的类型
.build(), // 别忘了.build()
[ // 设置刀的自带附魔
SBEnchantmentDefinition.of("minecraft:power", 5),
SBEnchantmentDefinition.of("minecraft:unbreaking", 10)
]
)
// 添加进游戏
event.addJson("kubejs:slashblade/named_blades/test_blade.json", SBSlashBladeDefinition.toJSON(customBlade))
})
许可
本模组遵循 GPL v3.0 协议开源。
你可以在遵循本协议的前提下将本模组加入你的整合包/服务器中。