- check_circle Functions
Published Aug 12th, 2022, 8/12/22 9:03 pm
- 1,335 views, 5 today
- 31 downloads, 0 today
4
> Abstract
This data pack translates player actions into booleans. I chose to use scoreboard objectives to represent the booleans ({score=1} == True, {score=0} == False). These objective scores are read-only and should NOT be modified manually in-game. This datapack is written by "Squid Workshop", and was originally uploaded on GitHub.- How to Install/Uninstall
- How to Use
- How It Works
- FAQ
- Terms of Use
- More About Squid Workshop
> How to Install/Uninstall
Load (Install)
- Step 1 Download "Bools-Datapack-Squid-Workshop-1.16.5.zip".
- Step 2 Go to minecraft saves directory, usually "C:/Users/youUserName/AppData/Roaming/.minecraft/saves".
- Step 3 Choose the world folder in which you want to install the packs.
- Step 4 Go to ../datapacks folder.
- Step 5 Move "Bools-Datapack-Squid-Workshop-1.16.5.zip" into ../datapacks folder.
- Step 6 Open Minecraft and open the world.
- Step 7 Type '/reload" command then press enter.
- Step 8 Enjoy
PS: If not working, check whether the datapack is enabled by:
/datapack list
Enable it by:
/datapack enable "datapackname"
Unload (Uninstall)
- Step 1 Delete the zip file from ../datapacks folder.
- Step 2 Use command:
/function app:unload/bools
This automatically deletes all the scoreboard objectives created in this datapack.
> How to Use
You can use the selector or if-statement in command to check if players have the scores.- This command gives an apple to players that jumped:
/execute as @a[scores={jump_bool=1}] run give @s minecraft:apple 1
- This command gives 1 second regeneration effect to players that start sleeping:
/execute as @a[scores={sleep_begin=1}] run effect give @s minecraft:regeneration 1 1 true
These boolean scores check two types of actions: Level and Edge.
Level action scores := (keep setting to 1 whenever) player is doing something
Edge action scores := (set to 1 for one tick if) player did something
The following is a list of all the scores:
Name | Type | Meaning |
---|---|---|
walk_bool | level | is walking |
walk_begin | edge | starts walking |
walk_end | edge | stops walking |
shift_bool | level | is pressing shift |
shift_begin | edge | starts pressing shift |
shift_end | edge | stops pressing shift |
sprint_bool | level | is sprinting |
sprint_begin | edge | starts sprinting |
sprint_end | edge | stops sprinting |
sleep_bool | level | is sleeping |
sleep_begin | edge | starts sleeping |
sleep_end | edge | stops sleeping |
jump_bool | edge | jumped |
offGrnd_begin | edge | lifted offground |
offGrnd_end | edge | landed |
shield_bool | level | has shield in main or off hand |
bow_bool | edge | used bow |
crossbow_bool | edge | used crossbow |
pearl_bool | edge | used ender pearl |
snowball_bool | edge | used snowball |
carotClik_bool | edge | right clicked using carrot stick |
fungiClik_bool | edge | right clicked using fungus stick |
fishrClik_bool | edge | right clicked using fishing rod |
container_bool | edge | interacted with a barrel/chest/enderchest/shulker_box/trap_chest//blast_furnace/furnace/smoker//dispenser/dropper/hopper |
> How It Works
Key Idea
Suppose we have two variables: walk_helper and walk_bool:
/scoreboard objectives add walk_meter minecraft.custom:minecraft.walk_one_cm
/scoreboard objectives add walk_bool dummy
The key idea of a Boolean detector is that we keep resetting the helper every tick. If the helper stays zero, the player is not taking any action. If the counter rises above zero, the player is doing stuffs.And here is a little piece of pseudo code to help us understand the logic:
Loop per tick:
# Game updates helper #
bool = 0
if ( helper > 0 ):
bool = 1
helper = 0
However, there are several tweaks on different objectives due some nuances of the game mechanism. For more detailed explanation. I strongly urge you to check out my GitHub page: >> Boolean Datapack - GitHub <<
> FAQ
Q: I don't know how to use GitHub. How can I download it?
A: On the GitHub page, you can see a Releases section on the right. Click it, which directs to the Releases page. Then click the Bools-Datapack-Squid-Workshop-1.16.5.zip file to download.
Q: What version of the game is it compatible with?
A: I wrote the pack in 1.16.5, and it is compatible upto at least 1.19.1 (and the foreseeable future versions). The syntax used are pretty basic, and I don't expect Mojang to make any big changes in the future.
Q: We created a lot of scoreboard objectives. Are they still there after I uninstall?
A: If we follow the instruction in the GitHub page, all of the objectives will be deleted. If we made a mistake while uninstalling, we can simply reinstall and uninstall it again.
Q: Why don't we use scoreboard tags instead of scoreboard objectives?
A: Because when we don't want to play with these scores anymore, we can just delete them. If we use tags, we cannot remove the tags on the players who are not online, which can cause trouble.
Q: What is the meaning of life?
A: You didn't know? It's just █̵̭̩̦͍̒͑█̵̳̝̃̚█̷̨̺̮͈̆̓͠█̷̙͑█
Q: What if I want more bools?
A: You can create "issues" on GitHub to make a suggestion, or just comment it here.
Q: Can I modify your pack to suit my need?
A: Yes you can. The datapack is under Mozilla Public License 2.0. However, please don't copy paste the code without acknowledging the source.
Q: What inspired you to make this datapack?
A: I was tired of writing same pieces of code for every datapack I made. Plus, I don't like adding a bunch of redundant scoreboard objectives for every datapack. So I decided to make an API datapack for everyone to use.
Q: I have more questions!
A: You can create "issues" on GitHub to make a suggestion, or just comment it here.
> Terms of Use
Feel free to play around with this datapack.As developer, feel free to use this datapack as a module to develop free datapacks.
But you must add the link to this github page!
NO COMMERCIAL USE
License
Mozilla Public License 2.0> More About Squid Workshop
See more datapacks developed by us hereWatch our videos on bilibili here
Watch our videos on Youtube here
Compatibility | Minecraft 1.16 |
to | Minecraft 1.19 |
Tags |
tools/tracking
5676985
119
player-action-detection-boolean-datapack-api
Create an account or sign in to comment.