A small datapack implementing a new type of interaction with Foxes.
This datapack aims to expand on the ability of Foxes to pick up items by adding a Fox variant (Kitsune) that can 'bless' items.
This datapack is intended and designed to be integrated with other datapack as a means of modifying items (similar to custom crafting with NBT data). Example of datapacks that integrate with kitsune include pseudo-enchantments and radiance.
World owners can refer to Integration § Datapacks to find links to datapacks that connect with kitsune.
Datapack creators can refer to Integration § Guide to learn how to connect their datapack(s) to kitsune.
This datapack was developed in 1.17 ("pack_format": 7
) but should be compatible with versions using an equivalent or greater pack_format
, barring major changes to commands/datapacks.
- Download:
- Repository as a
.zip
(Code > Download ZIP) - Release (will need to unzip before installing into a save)
- Repository as a
- Install into a save like any other datapack.
- (Optional) Install other datapacks that connect with kitsune.
- Open the advancement menu to the Schwer tab to view the intended hints.
Kitsune is a custom Fox variant that can be visually identified by the glowing particles they emit. They are unaffected by physical forces (pushing, gravity, water, etc), cannot breed, and always asleep. Players can interact with Kitsune to 'bless' items.
Foxes can be converted into Kitsune by naming them kitseudo.
Kitsune can be converted back into foxes by naming them release.
Kitsune can be tempted into dropping its held item by being fed berries.
A Kitsune holding an item can bless the item under the right conditions (e.g. dropping a blessing material near them).
This datapack does not implement any actual blessings, rather, it enables other datapacks to implement their own blessings — see Integration § Datapacks.
Split between 'Available' (i.e. fine to call using /function
) and 'Internal' (not intended to be called by /function
).
Ordered alphabetically.
Removes the presence of this datapack by:
- Clearing the scheduled
tick
function - Calling
kitsune_release
on all Kitsune
Note that since it is possible that unloaded chunks contain Kitsune, this can't guarantee to completely remove the presence of this datapack (i.e. some Kitsune may still exist but become non-functional until the datapack is reloaded).
Handles the logic for granting the enchant
advancement to the player who dropped the target item.
Not used in this datapack, intended to be used by other datapacks — see Integration.
Plays sound effects for when a Kitsune blesses an item.
Not used in this datapack, intended to be used by other datapacks — see Integration.
Forcibly unequips a Kitsune's held item.
Called from kitsune_tick
on Kitsune that have been fed (i.e. in 'breeding mode').
Converts a Fox into a Kitsune.
Called from tick
on Foxes named kitseudo.
Converts a Kitsune back into a Fox.
Called from kitsune_tick
on Kitsune named release.
The update loop for each Kitsune. Handles (in execution order):
- Forcing Kitsune to drop their held item when fed (
kitsune_drop
) - Enforcing Kitsune behaviour (no AI, not in love, sleeping)
- Interestingly, Foxes with
NoAI:1b
still pick up items (but never eat held food). Not sure if this is intentional game behaviour, but it works for now.
- Interestingly, Foxes with
- Releasing named Kitsune (
kitsune_release
) - Trying to 'bless' a Kitsune's held item (
#kitsune:try_enchant
)
Additionally handles the particle effect differentiating Kitsune from normal Foxes.
Sets up this datapack by starting the tick
loop.
Called through Minecraft's load.json
.
The main update loop. Handles marking of named Foxes to be converted into Kitsune and kitsune_tick
.
Initialises from load
.
(Roughly in personal use order)
- Minecraft Wiki
- Misode's Data Pack Generators
- MCStacker
- radiance
- Imitating dropping items from an inventory
- gateways
- Granting advancement to player who dropped a specific item
To integrate with kitsune, your datapack will need, at minimum, three files:
try_enchant.json
, a function tag in thekitsune
namespace- a check function, to check if the blessing should be applied to the held item
- a blessing function, to apply the blessing to the held item
In data/kitsune/tags/functions/try_enchant.json
you should include check functions for each blessing interaction you wish to add. For example, from pseudo-enchantments:
{
"values": [
"extinguish:kitsune_enchant_check"
]
}
#kitsune:try_enchant
is called on (and at) any Kitsune that is holding an item while there is an item on the ground within 1.425 blocks (the item pickup range (for players), according to the wiki) away. Specifically, the selector is:
@e[type=item,nbt={OnGround:1b},limit=1,sort=nearest,distance=..1.425]
This should be used to target the item in functions called from #kitsune:try_enchant
.
Your check function should check if the held item is blessable, preferrably using a predicate like so:
[
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"equipment": {
"mainhand": {
"items": [
"<namespace>:<item_id>"
]
}
}
}
}
]
You could also include incompatibilities like so:
// Continued from above (before closing square bracket)
{
"condition": "minecraft:inverted",
"term": {
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"nbt": "{HandItems:[{tag:{display:{Lore:['{\"text\":\"Extinguish\",\"color\":\"#7373DD\",\"italic\":false}']}}}]}"
}
}
}
]
Your check function should then have a second if for the target item (blessing material).
A template for a possible check function:
execute if entity @s[predicate=<namespace>:<valid_held_item>] if entity @e[type=item,nbt={OnGround:1b},limit=1,sort=nearest,distance=..1.425,predicate=<namespace>:<valid_blessing_material>] run function <namespace>:<apply_blessing>
How you want your blessing function to work is up to you. If you'd liked to see an example, refer to the one for extinguish
in the pseudo-enchantments datapack.
Some suggestions:
- Append lore to the held item:
data modify entity @s HandItems[0].tag.display.Lore append value <value>
- Play the Kitsune blessing sound:
function kitsune:kitsune_bless
- Grant the advancement
kitsune:enchant
:data modify storage schwer:sks_store Thrower set from entity @e<item; copy from your check function> Thrower execute as @a run function kitsune:grant_advancement data remove storage schwer:sks_store Thrower
- Consume the blessing material:
kill @e<item; copy from your check function>
- pseudo-enchantments
- Pseudo-enchant items using Enchanted Scrolls
- radiance
- Revert Radiance into Fragile Radiance