Ritual thingy
一个允许模组、整合包或数据包创作者添加数据驱动召唤仪式的模组。
功能
多块结构
目前通过 Patchouli 支持多块结构,其他多块系统正在开发中。
通过 Patchouli json 文件或使用 Patchouli API 添加多块结构。
添加到 ritual-thingy:altar 方块标签中的方块在右键点击时会检查多块结构。
物品条件
模组支持玩家主手中物品的条件。可以使用 API 添加其他物品条件。
怪物波次
模组支持添加多个波次,每个波次包含多个具有可自定义 NBT 数据的怪物组。每个波次可以拥有自定义名称、Boss 栏颜色以及两种 Boss 栏运行模式(按实体数量和总实体生命值)。
物品动作
模组支持将物品放入背包、在仪式方块内掉落或在仪式方块上方掉落。可以使用 API 添加其他物品动作。
其他功能包括可自定义延迟时间的 Boss 栏、自定义开始和结束消息以及自定义开始和结束音效。
格式
仪式文件应位于 data/YOUR_NAMESPACE/rituals/RITUAL_NAME.json
标记为 * 的键是必填项(但如果父标签被省略,则可以省略)
{
"soundEvent": "block.beacon.activate", //开始时播放的声音
"maxUses": 1, //每个玩家的最大仪式使用次数。设置为 0 以禁用
"altar"*: {
"patchouli": true, //必须设置为 true
"id"*: "ritual-thingy:test_altar", //Patchouli 祭坛的标识符
"itemCondition": { //如果不包含此项则禁用物品条件
"predicate": "ritual-thingy:mainhand", //谓词的标识符(默认为 "ritual-thingy:mainhand")
"ingredient"*: { //原料:使用与配方相同的格式
"item": "minecraft:stick"
},
"decrement":1 //如果使用正确的物品,从堆叠中移除这么多物品
},
"dimensionCondition":{
"dimensions":[
"minecraft:overworld"
], //允许的维度列表
"allowed":true //True 表示列表中的维度是允许的,False 表示是不允许的
}
},
"stack": { //物品奖励,参见 [Item Stack](https://origins.readthedocs.io/en/latest/types/data_types/item_stack/)
"item"*: "minecraft:diamond_sword"
"count" : 1
},
"startMessage": "Ritual starting", //开始时发送的消息
"completeMessage": "Ritual ending", //结束时发送的消息
"completeAction": "ritual-thingy:drop_offset", //物品动作的标识符(默认为 "ritual-thingy:none")
"trial": { //省略此项则仪式立即完成
"waveTickDelay": 80, //试炼波次之间的延迟,以刻为单位
"beginningCountdown": 80, //试炼的倒计时,以刻为单位
"delayBossBarColor": "blue", //延迟和倒计时的 Boss 栏颜色
"waves"* : [ //实体波次
{
"bossBarText": "Pig", //波次的 Boss 栏文本
"bossBarColor": "blue", //波次的 Boss 栏颜色
"isBoss": true, //如果 Boss 栏应显示生命值而不是实体数量
"spawnRange": 4, //从点击的方块生成的怪物范围
"startSound": "entity.wither.shoot", //波次开始时播放的声音
"endSound": "entity.experience_orb.pickup", //波次结束时播放的声音
"groups": [ //单独的实体组
{//此组包含一只没有额外数据的猪
"count": 1,
"entityType"*: "minecraft:pig"
}
]
},
{
"bossBarText": "Cows",
"bossBarColor": "blue",
"spawnRange": 4,
"startSound": "entity.wither.shoot",
"endSound": "entity.experience_orb.pickup",//使用最后一个波次的结束声音作为整个仪式的结束声音
"groups": [
{
"count": 8,
"entityType"*: "minecraft:cow",
"tag": "{}" //额外的实体数据(名称、盔甲、效果、变种...)
}
]
}
]
}
}
依赖
若要作为开发者使用 API 或其他模组部分,请将以下内容添加到你的 build.gradle
repositories {
maven {
url = 'https://maven.riftrealms.de/releases'
}
repositories {
maven { url 'https://maven.blamejared.com' }
}
}
dependencies {
//将版本添加到你的 gradle.properties 中,或用模组版本替换 ${project.ritual_thingy_version}
modApi "eu.ansquare.ritualthingy:ritual-thingy:${project.ritual_thingy_version}"
}
API
Ritual API 允许模组制作者添加自己的物品动作、条件和阻止仪式开始的事件。它们通过以下格式在通用初始化程序中注册:
条件
ItemConditionPredicate YOUR_CONDITION = RitualApi.registerItemCondition(new Identifier("YOUR_MOD_ID", "YOUR_CONDITION_ID"), (ingredient, player, pos) -> {
ItemStack stack = //获取物品堆叠
return new Pair<>(ingredient.test(stack), stack);//使用原料测试堆叠并返回它以便可能的减少数量
});
默认条件有
- ritual-thingy:mainhand 检查玩家主手中的物品
动作
ItemConditionPredicate YOUR_ACTION = RitualApi.registerItemAction(new Identifier("YOUR_MOD_ID", "YOUR_ACTION_ID"), (stack, player, pos) -> {
//执行动作
});
默认动作有
- ritual-thingy:none 什么都不做
- ritual-thingy:give 将物品给玩家
- ritual-thingy:drop 在仪式方块位置掉落物品
- ritual-thingy:drop_offset 在仪式方块上方一格掉落物品(在其顶部)
仪式阻止
PreventRitualCallback.EVENT.register((player, world, hand, hitResult) -> {
return false; //如果不允许发生仪式则返回 false
});
Ritual thingy
A mod allowing mod, modpack or datapack creators to add data-driven summoning rituals.
Features
Multiblocks
Multiblocks are currently supported via Patchouli, with other multiblock system being developed.
Add multiblocks via Patchouli json files, or using the Patchouli API.
Blocks added to the ritual-thingy:altar block tag are checked for multiblocks when right-clicked.
Item conditions
The mod supports item conditions in the player's main hand. Other item conditions can be added with the API.
Mob waves
The mod supports adding multiple waves, each with multiple groups of mobs with customizable NBT. Each wave may have a custom name, boss bar color and two modes of boss bar operation (By entity number and total entity health.
Item actions
The mod supports giving items to the inventory, droppping them inside the ritual block, or dropping them above the ritual block. Other item actions can be added with the API.
Other features include customizable delay boss bars, custom start and end messages and custom start and end sounds.
Format
Ritual files should be in data/YOUR_NAMESPACE/rituals/RITUAL_NAME.json
Keys marked with * are mandatory (But can be omitted if the parent tag is)
{
"soundEvent": "block.beacon.activate", //Sound played at the start
"maxUses": 1, //Maximum ritual uses per player. Set to 0 to disable
"altar"*: {
"patchouli": true, //Must be set to true
"id"*: "ritual-thingy:test_altar", //Identifier of the patchouli altar
"itemCondition": { //Don't include to disable item condition
"predicate": "ritual-thingy:mainhand", //Identifier of the predicate (Defaults to "ritual-thingy:mainhand")
"ingredient"*: { // Ingredient: Uses the same format as recipes
"item": "minecraft:stick"
},
"decrement":1 //Remove this many items from the stack if the correct item is used
},
"dimensionCondition":{
"dimensions":[
"minecraft:overworld"
], //List of allowed dimensions
"allowed":true //True means the list if the allowed dimension, false means it is the disallowed
}
},
"stack": { //Item reward, see [Item Stack](https://origins.readthedocs.io/en/latest/types/data_types/item_stack/)
"item"*: "minecraft:diamond_sword"
"count" : 1
},
"startMessage": "Ritual starting", //Message sent at the start
"completeMessage": "Ritual ending", //Message sent at the end
"completeAction": "ritual-thingy:drop_offset", //Identifier of the item action (Defaults to "ritual-thingy:none")
"trial": { //Omit to have the ritual completed instantly
"waveTickDelay": 80, //Delay between trial waves, in ticks
"beginningCountdown": 80, //Countdown to the trial, in ticks
"delayBossBarColor": "blue", //Boss bar color for the delay and countdown
"waves"* : [ //Waves of entities
{
"bossBarText": "Pig", //Boss bar text for the wave
"bossBarColor": "blue", //Boss bar color for the wave
"isBoss": true, //If boss bar should display health instead of amount of entities
"spawnRange": 4, //Mob spawn range from the clicked block
"startSound": "entity.wither.shoot", //Sound played at start of wave
"endSound": "entity.experience_orb.pickup", //Sound played at end of wave
"groups": [ //Individual groups of entities
{//This group contains one pig with no extra data
"count": 1,
"entityType"*: "minecraft:pig"
}
]
},
{
"bossBarText": "Cows",
"bossBarColor": "blue",
"spawnRange": 4,
"startSound": "entity.wither.shoot",
"endSound": "entity.experience_orb.pickup",//Use the ending sound of the last wave as the ending sound of the ritual itself
"groups": [
{
"count": 8,
"entityType"*: "minecraft:cow",
"tag": "{}" //Additional entity data (Name, armor, effects, variant...)
}
]
}
]
}
}
Dependency
To use the API or other parts of the mod as a developer, add this to your build.gradle
repositories {
maven {
url = 'https://maven.riftrealms.de/releases'
}
repositories {
maven { url 'https://maven.blamejared.com' }
}
}
dependencies {
//Add the version to your gradle.properties or replace ${project.ritual_thingy_version} with the mod version
modApi "eu.ansquare.ritualthingy:ritual-thingy:${project.ritual_thingy_version}"
}
API
The Ritual API allows modders to add their own item actions, conditions and events that prevent a ritual from starting. They are registered in the common initializer with the following formats:
Conditions
ItemConditionPredicate YOUR_CONDITION = RitualApi.registerItemCondition(new Identifier("YOUR_MOD_ID", "YOUR_CONDITION_ID"), (ingredient, player, pos) -> {
ItemStack stack = //Get the item stack
return new Pair<>(ingredient.test(stack), stack);//Test the stack with the ingredient and return it for possible decrementing
});
The default conditions are
- ritual-thingy:mainhand checks the item in the player's main hand
Actions
ItemConditionPredicate YOUR_ACTION = RitualApi.registerItemAction(new Identifier("YOUR_MOD_ID", "YOUR_ACTION_ID"), (stack, player, pos) -> {
//Execute the action
});
The default actions are
- ritual-thingy:none to do nothing
- ritual-thingy:give to give the item to the player
- ritual-thingy:drop to drop it at the ritual block's position
- ritual-thingy:drop_offset to drop it one block above the ritual block (on top of it)
Ritual prevention
PreventRitualCallback.EVENT.register((player, world, hand, hitResult) -> {
return false; //Return false if a ritual is not allowed to happen
});
评论 0
登录后参与评分
还没有评论,来抢沙发吧