Module: command_attachment
Overview
This module allows attaching commands to various objects:
-
Item Stacks
-
Blocks
-
Entities
-
...
Color Boxes
◉ How it works?
When you attach commands into an item.
We will save a binding ID in the item NBT.
Every item that has the same binding ID in its NBT data, shares the same binding commands instance.
◉ Valid interaction types for each attached types.
-
item:LEFT_CLICK,RIGHT_CLICK,ANY_CLICK,SWAP_HAND -
block:LEFT_CLICK,RIGHT_CLICK,ANY_CLICK,STEP_ON -
entity:RIGHT_CLICK,ANY_CLICK
◉ Give the attached item to players.
You can use kit module.
The kit module will save the item NBT.
So if you define a kit, puts the attached item inside it.
Then give the kit to a player.
The player will get the magic item.
◉ Integrate with command_cooldown module.
You can use command_cooldown module to create a named cooldown.
The named cooldown can restrict the use interval and use times of a specified command.
And then, attach the named cooldown test command to an item using command_attachment module.
◉ Make a magic-stick, which heals the player on clicked.
Issue /command-attachment attach-item-one heal
◉ Make a magic-stick, which:
-
Gives diamonds * 1 on left clicked. (With use limit 3)
-
Gives gold_ingot *1 on right clicked. (With use limit 5)
Issue the following commands:
-
/command-attachment attach-item-one --maxUseTimes 3 --interactType LEFT_CLICK give %player:name% minecraft:diamond 1 -
/command-attachment attach-item-one --maxUseTimes 5 --interactType RIGHT_CLICK give %player:name% minecraft:gold_ingot 1
◉ Make a magic-stick, which gives apple * 1, with use limit 3 times, and keep the item without destroying it.
Issue: /command-attachment attach-item-one --maxUseTimes 3 --destroyItem false give %player:name% minecraft:apple 1.
◉ Query the attached commands in a specific item.
Issue /command-attachment query-item.
◉ Let an entity say hello on right clicked.
Issue: /command-attachment attach-entity-one <entity-id> say hello %player:name%
◉ Make a portal block.
Issue: /command-attachment attach-block-one 0 0 0 --interactType STEP_ON tppos --targetPlayer %player:name% --dimension minecraft:the_end --x 0 --y 66 --z 0 %player:name%.
◉ View and edit the attached object.
Issue: /command-attachment editor
Configurations
The following JSON content is provided for reference only. It must NOT be copied directly into the configuration directory, as it does not represent valid JSON syntax.
- File Name:
command-attachment-data.json - File Content:
Click to see the default content...
{
"nodes": []
}
- File Name:
config.json - File Content:
Click to see the default content...
{
"test_stepping_on_block_interval_in_mill_seconds": 100
}
Jobs
-
Job Name:
ConfigurationHandlerWriteStorageJob -
Document: This
jobis used towrite datafrommemoryintostorage.NOTE: If you modify the
fileindisk, then you need to issue/fuji reloadas soon as possible.NOTE: The
diskwill beoverriddenwhenfirethis job.
- Job Name:
TestSteppingOnBlockJob - Document: This
jobis used to test if the player is stepping on ablockwithattached commands.
Commands
-
Command Syntax:
/command-attachment attach-block-one <BlockPos blockPos> [InteractType interactType] [Integer maxUseTimes] [ExecuteAsType executeAsType] <GreedyCommandString command> -
Document: Attach one command to specified block.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment attach-entity-one <Entity entity> [InteractType interactType] [Integer maxUseTimes] [ExecuteAsType executeAsType] <GreedyCommandString command> -
Document: Attach one command to an entity.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment attach-item-one [InteractType interactType] [Integer maxUseTimes] [ExecuteAsType executeAsType] [Boolean destroyItem] <GreedyCommandString command> -
Document: Attach one command to an item.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment detach-block-all <BlockPos blockPos> [Boolean confirm] -
Document: Detach all attached commands in the block.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment detach-entity-all <Entity entity> [Boolean confirm] -
Document: Detach all attached commands in the entity.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment detach-item-all [Boolean confirm] -
Document: Detach all attached commands in the item.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment editor -
Document: Open the command attachment editor.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment query-block <BlockPos blockPos> -
Document: Query all attached commands in the block.
-
Can be executed by console:
true -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment query-entity <Entity entity> -
Document: Query all attached commands in the entity.
-
Can be executed by console:
true -
Required Level Permission:
4 -
Required String Permission:
null
-
Command Syntax:
/command-attachment query-item -
Document: Query all attached commands in the item.
-
Can be executed by console:
false -
Required Level Permission:
4 -
Required String Permission:
null
Argument Types
- Argument Type Name:
[execute-as-type] - Argument Type Class:
[ExecuteAsType]
- Argument Type Name:
[interact-type] - Argument Type Class:
[InteractType]