Skip to content

Commit

Permalink
fix: Add dfu for old spawn eggs
Browse files Browse the repository at this point in the history
  • Loading branch information
GearsDatapacks committed Apr 27, 2024
1 parent ea12326 commit 4c2f8dc
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 1 deletion.
53 changes: 53 additions & 0 deletions data/bot/advancements/dfu/v0-3-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"criteria": {
"requirement": {
"trigger": "minecraft:tick",
"conditions": {
"player": [
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"equipment": {
"mainhand": {
"items": "minecraft:sheep_spawn_egg",
"predicates": {
"minecraft:custom_data": {
"bot": {
"id": "bot_spawn"
}
}
}
}
}
}
},
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"equipment": {
"mainhand": {
"items": "minecraft:sheep_spawn_egg",
"predicates": {
"minecraft:custom_data": {
"bot": {
"version": {}
}
}
}
}
}
}
}
}
]
}
}
},
"rewards": {
"function": "bot:dfu/v0-3-2"
}
}
2 changes: 2 additions & 0 deletions data/bot/functions/dfu/v0-3-2.mcfunction
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
advancement revoke @s only bot:dfu/v0-3-2
item modify entity @s weapon.mainhand bot:dfu/v0-3-2
4 changes: 3 additions & 1 deletion data/bot/functions/entity/spawn.mcfunction
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
function bot:entity/summon
data modify entity @e[type=marker,tag=bot.golem.brain,sort=nearest,limit=1] data set from entity @s data
data modify storage bot:private temp.data set from entity @s data
data modify storage bot:private temp.data.version set from storage bot:version
data modify entity @e[type=marker,tag=bot.golem.brain,sort=nearest,limit=1] data set from storage bot:private temp.data

kill @s
27 changes: 27 additions & 0 deletions data/bot/item_modifiers/dfu/v0-3-2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[
{
"function": "minecraft:set_components",
"components": {
"minecraft:entity_data": {
"id": "minecraft:marker",
"Tags": [
"bot.spawn"
]
}
}
},
{
"function": "minecraft:copy_custom_data",
"source": {
"type": "minecraft:storage",
"source": "bot:version"
},
"ops": [
{
"source": "{}",
"target": "bot.version",
"op": "merge"
}
]
}
]
14 changes: 14 additions & 0 deletions data/bot/loot_tables/spawn.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@
"italic": false
}
]
},
{
"function": "minecraft:copy_custom_data",
"source": {
"type": "minecraft:storage",
"source": "bot:version"
},
"ops": [
{
"source": "{}",
"target": "bot.version",
"op": "merge"
}
]
}
]
}
Expand Down

0 comments on commit 4c2f8dc

Please sign in to comment.