- 模组加载器
- Forge
- Fabric
- 版权类型
- 转载
- 前置组件
- https://link.mcmod.cn/target/aHR0cHM6Ly93d3cuY3Vyc2Vmb3JnZS5jb20vbWluZWNyYWZ0L21jLW1vZHMva3ViZWpz
- 语言支持
- 英语
- 适配版本
- 1.18
- 1.19
- 1.20
通过 KubeJS 配置的不仅仅是进步
高级 JS 2001forge-2.9.4
锻造 1.20.1
释放
高级 JS 2001fabric-2.9.4
结构 1.20.1
释放
高级 JS 1902fabric-2.6.0
织物 1.19.2
释放
高级 JS 1902forge-2.6.0
锻造 1.19.2
释放
高级 JS 1802forge-1.9.0
锻造 1.18.2
释放
高级 JS 1802fabric-1.6.1
结构 1.18.2
释放
韦斯特纳特233
所有者
https://modrinth.com/user/westernat233
https://modrinth.com/user/westernat233
此为转载请勿商用,详见https://modrinth.com/mod/advancementjs
快速示例(适用于最新版本)2.9.3)
启动脚本
JavaScript:
// Create a custom trigger
AdvJSEvents.trigger(event => {
event.create("advjs:get_adv")
// How many matches you defined, how many tests you should put in
// In this example, we defined 2 matches
.match(advancement => advancement.getId() == "minecraft:story/smelt_iron")
.match(playerName => playerName == "Dev")
})
服务器脚本
JavaScript:
AdvJSEvents.advancement(event => {
const { PREDICATE, TRIGGER } = event;
// Define trigger
const jump5times = TRIGGER.tick(triggerBuilder =>
triggerBuilder.addStat(Stats.JUMP, Stats.CUSTOM, { min: 5 }));
const bred_in_nether = TRIGGER.bredAnimals(triggerBuilder => {
triggerBuilder.setChildByPredicate(PREDICATE.entityFromJson({
stepping_on: {
dimension: "the_nether"
}
}))
});
// AdvJS custom trigger
const destroy_dirt = TRIGGER.blockDestroyed(triggerBuilder => triggerBuilder.setBlock("dirt"));
// Your custom trigger
const get_adv = TRIGGER.custom("advjs:get_adv");
// Create root advancement
const root = event.create("advjs:hell")
.display(displayBuilder => {
displayBuilder.setTitle("AdvancementJS")
displayBuilder.setDescription("Quick example")
displayBuilder.setIcon("diamond")
})
.criteria(criteriaBuilder => criteriaBuilder.add("dirt", destroy_dirt))
.rewards(rewardsBuilder => {
rewardsBuilder.setExperience(100)
// AdvJS custom reward
rewardsBuilder.addEffect("absorption", 200)
})
// Make it repeatable
.repeatable();
// Add child for root
root.addChild("child1", childBuilder => {
childBuilder
.display(displayBuilder => {
displayBuilder.setTitle(Text.red("Holy"))
displayBuilder.setDescription(Text.red("Hell starts"))
})
.criteria(criteriaBuilder => {
// 'OR' means that if you want to achieve this advancement,
// you just need one of two triggers matched below
criteriaBuilder.setStrategy(RequirementsStrategy.OR)
criteriaBuilder.add("bred", bred_in_nether)
criteriaBuilder.add("jump", jump5times)
criteriaBuilder.add("get_adv", get_adv)
})
.rewards(rewardsBuilder => {
rewardsBuilder.setRecipes("minecraft:lodestone", "minecraft:brewing_stand")
rewardsBuilder.setExperience(100)
})
});
// Remove an exist advancement by AdvancementFilter, available filter was writen in doc.
// you can also remove by id: 'event.remove("minecraft:story/lava_bucket");'
event.remove({
mod: "minecraft",
icon: "minecraft:lava_bucket",
frame: "task"
});
// Modify an exist advancement
event.get("minecraft:story/smelt_iron")
// Apply offset to display
.displayOffset(1, 1, true)
.modifyDisplay(displayBuilder => displayBuilder.setIcon("diamond_pickaxe"))
.addChild("child2", childBuilder => {
childBuilder
.display(displayBuilder => {
displayBuilder.setIcon("recovery_compass")
displayBuilder.setTitle('I will come back!')
displayBuilder.setDescription(Text.green("Good luck"))
// You can also apply display in DisplayBuilder
displayBuilder.offset(-1, 0)
})
// The trigger could also be created from json
.criteria(criteriaBuilder => criteriaBuilder.add("go_back_to_home", TRIGGER.fromJson({
"trigger": "minecraft:changed_dimension",
"conditions": {
"from": "minecraft:the_end",
"to": "minecraft:overworld"
}
})))
// Check if parent done, else it will not be done
.requireParentDone()
});
})
AdvJSEvents.lock(event => {
event.result("stone_slab", "minecraft:story/smelt_iron");
event.itemUse("spyglass", "minecraft:story/smelt_iron");
event.blockInteract("chest", "minecraft:story/smelt_iron");
event.entityInteract("villager", "minecraft:story/smelt_iron");
})
// Compat with 'Better Advancements'
AdvJSEvents.betterAdv(event => {
event.modify("advjs:hell/child1").posX(0).posY(32).hideLines()
})
PlayerEvents.advancement(event => {
const player = event.getPlayer();
// The first argument is use for match player predicate, the other two is the matches you defined
CustomTriggers.of("advjs:get_adv").trigger(player, event.getAdvancement(), player.username)
})
如何重新加载
只需使用/reload特征
- 用于生成内置示例的命令/advjs
- 您可以在 Startup 事件中创建自定义触发器。AdvJSEvents.trigger
- AdvJS 自定义触发器
- blockDestroyed:当玩家打破一个方块时触发。
- playerTouch:当玩家触摸实体时触发。
- bossEvent:当游戏加入 Boss 战时触发。
- increaseKillScore:当玩家杀死一个实体时触发。
- AdvJS 自定义奖励
- addEffect:生效。
- AdvJS 自定义方法
- displayOffset(offsetX: number, offsetY: number, modifyChildren?: 布尔值)
- 将偏移应用于 Advancement Display 及其子项
- requireParentDone()
- 检查父项是否完成,否则将不会完成。
- requireOthersDone(requires[]: ...ResourceLocation)
- 检查您投入的进步是否已经完成。
- requireAnyDone(requires[]: ...ResourceLocation)
- displayOffset(offsetX: number, offsetY: number, modifyChildren?: 布尔值)
- 兼容性
- Better Advancements,新服务器事件:AdvJSEvents.betterAdv
链接
报告问题查看源代码访问 wiki特色版本
查看全部高级 JS 2001forge-2.9.4
锻造 1.20.1
释放
高级 JS 2001fabric-2.9.4
结构 1.20.1
释放
高级 JS 1902fabric-2.6.0
织物 1.19.2
释放
高级 JS 1902forge-2.6.0
锻造 1.19.2
释放
高级 JS 1802forge-1.9.0
锻造 1.18.2
释放
高级 JS 1802fabric-1.6.1
结构 1.18.2
释放
项目成员
韦斯特纳特233
所有者
https://modrinth.com/user/westernat233
https://modrinth.com/user/westernat233
此为转载请勿商用,详见https://modrinth.com/mod/advancementjs