So I figured if I'm going to be diving into addons might as make an account on here for help instead of hours of trial and hour. Anyway, I'm trying to make a village guards addon atm that involves presenting either a sword or a bow to a villager and that makes them transform into the respective entity. Either a bowguard or a swordguard. As I'm new to addons I was astonished I was able to even make it work lol but it seems it only works with one item at a time. For instance I can only use a bow or a sword to turn the entity into that respective guard. It won't allow me to use both. I suspect it's because instead of duplicating the interaction event I need to place both interactions within that string, but I just don't what the proper way to do that is. To better clarify I want (if given a bow, turn into bowguard, if given a sword, turn into swordguard) but it only allows me to do this one item.
It works fine on it's own, but I want to be able to add another interaction with a sword which causes a "become_swordguard" event. I have a feeling its something as simple as properly formatting another on_interact inside the interactions but I can't figure out how to do that properly.
So I figured if I'm going to be diving into addons might as make an account on here for help instead of hours of trial and hour. Anyway, I'm trying to make a village guards addon atm that involves presenting either a sword or a bow to a villager and that makes them transform into the respective entity. Either a bowguard or a swordguard. As I'm new to addons I was astonished I was able to even make it work lol but it seems it only works with one item at a time. For instance I can only use a bow or a sword to turn the entity into that respective guard. It won't allow me to use both. I suspect it's because instead of duplicating the interaction event I need to place both interactions within that string, but I just don't what the proper way to do that is. To better clarify I want (if given a bow, turn into bowguard, if given a sword, turn into swordguard) but it only allows me to do this one item.
Here's the string I suspect to be the problem:
"minecraft:interact": {
"interactions": {
"on_interact": {
"filters": {
"all_of": [
{ "test": "has_equipment", "domain": "hand", "subject": "other", "value": "bow" },
{ "test": "has_component", "subject": "self", "operator": "!=", "value": "minecraft:is_baby" }
]
},
"event": "become_bowguard",
"target": "self"
},
"use_item": true
}
},
It works fine on it's own, but I want to be able to add another interaction with a sword which causes a "become_swordguard" event. I have a feeling its something as simple as properly formatting another on_interact inside the interactions but I can't figure out how to do that properly.
Here's the full json:
{
"format_version": "1.16.100",
"minecraft:entity": {
"description": {
"identifier": "minecraft:villager_v2",
"is_spawnable": true,
"is_summonable": false,
"is_experimental": false
},
"component_groups": {
"trade_resupply_component_group": {
"minecraft:trade_resupply": {}
},
"become_witch": {
"minecraft:transformation": {
"into": "minecraft:witch",
"delay": 0.5
}
},
"become_zombie": {
"minecraft:transformation": {
"into": "minecraft:zombie_villager_v2",
"keep_level": true
}
},
"become_swordguard": {
"minecraft:transformation": {
"into": "ayrtown:steve"
}
},
"become_bowguard": {
"minecraft:transformation": {
"into": "ayrtown:alex"
}
},
"work_schedule": {
"minecraft:scheduler": {
"min_delay_secs": 0,
"max_delay_secs": 10,
"scheduled_events" : [
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 0 },
{ "test": "hourly_clock_time", "operator": "<", "value": 8000 }
]
},
"event": "minecraft:schedule_work_pro_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 8000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 10000 }
]
},
"event": "minecraft:schedule_gather_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 10000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 11000 }
]
},
"event": "minecraft:schedule_work_pro_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 11000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 12000 }
]
},
"event": "minecraft:schedule_home_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 12000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 24000 }
]
},
"event": "minecraft:schedule_bed_villager"
}
]
}
},
"basic_schedule": {
"minecraft:scheduler": {
"min_delay_secs": 0,
"max_delay_secs": 10,
"scheduled_events" : [
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 0 },
{ "test": "hourly_clock_time", "operator": "<", "value": 8000 }
]
},
"event": "minecraft:schedule_wander_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 8000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 10000}
]
},
"event": "minecraft:schedule_gather_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 10000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 11000 }
]
},
"event": "minecraft:schedule_wander_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 11000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 12000 }
]
},
"event": "minecraft:schedule_home_villager"
},
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator": ">=", "value": 12000 },
{ "test": "hourly_clock_time", "operator": "<", "value": 24000 }
]
},
"event": "minecraft:schedule_bed_villager"
}
]
}
},
"child_schedule": {
"minecraft:scheduler": {
"min_delay_secs": 0,
"max_delay_secs": 10,
"scheduled_events" : [
{
"filters": {
"all_of": [
{ "test": "hourly_clock_time", "operator":