FTMC TouchSign Datapack
A datapack framework that gives your datapack the ability to tell which part of a wall sign that a player clicked on. Works in Vanilla Minecraft 1.13 through 1.21.5.
FTMC TouchSign Datapack
This is a datapack framework that lets you use a sign like a touchscreen. In other words, it gives your datapack the ability to tell which part of a wall sign that a player clicked on.
How to use this framework:
Step1. Download this datapack framework & Step1.. Please check your Minecraft version and download the corresponding datapack from one of the links on this page.
Step2. Step2. and put it into the same datapack folder.
In your datapack, there must be an `mcfunction` file that invocates the FTMC TouchSign framework, so you will get some information about the clicking position.
For an example, we create a file called onclick.mcfunction and put it in your datapack: ``` function ftmc:touchsign/click_handler execute if score @s fttsign_touchx matches <X1>..<X2> if score @s fttsign_touchy matches <Y1>..<Y2> run <YourAction1> execute if score @s fttsign_touchx matches <X3>..<X4> if score @s fttsign_touchy matches <Y3>..<Y4> run <YourAction2>
Please replace X1 ~ X4 and Y1 ~ Y4 above with the exact coordinate values.
```
In this function, `fttsign_touchx` and `fttsign_touchy` refers to the coordinates that the player clicks onto the sign.
* `fttsign_touchx` ranges from `-500` (leftmost) to `500` (rightmost) * `fttsign_touchy` ranges from `-250` (top) to `250` (bottom)
The example above will make your sign run `<YourAction1>` when clicking on the green zone of the following screenshot & and run `<YourAction2>` when clicking on the green zone below:

Step3. Make a clickable sign and obtain the sign with a `/give` command. Some examples can be seen on the demo folders of this project.
Click on the links below for the example in each corresponding Minecraft version: - For 1.21.5 | For 1.20.5 - 1.21.4 | For 1.20 - 1.20.4 | For 1.14 - 1.19.4 | For 1.13 - 1.13.2
When to use this framework in my project
This framework provides several demo examples as follows: * A piano keyboard - This is where you may check how the clicking positions on the sign may affect scoreboard values. * A piano keyboard (with two variants available for whether or not the piano keyboard is enabled) - This simulates how a real computer keyboard behaves. By clicking onto the position of a letter, a debug message containing the letter will show on the chat. * A piano keyboard - Playing range: C3 - C5 (25 keys) - By clicking onto different keys on the piano sign, it plays the sound in different frequencies, resembling how it acts on an actual piano.
All these examples can be found in the source code & you may obtain the sign items by running any of the commands like `/function ftmc:touchsign/demo/give_xxxxx_sign` (where `xxxxx` should be replaced.)
These usages are just a few examples. You might still discover quite some other interesting and practical usages. Feel free to publish your own datapack that uses this framework as long as you follow the "Usage Terms" section written below. Hope you enjoy! 😄
FAQs
1. I'm creating a new map and trying to import the FTMC TouchSign datapack, but it tells me "Incompatible!" * Please first ensure that the datapack you downloaded corresponds to the correct Minecraft version. * If correct, please ignore the "Incompatible" warning and import it into your world anyway. It should be still working. * If you found any issues in the gameplay, please report it as a bug in the GitHub issues page.
2. The datapack doesn't correctly detect the clicking position when I'm going far away from the spawn point. * Due to the limitations of scoreboard data types (32-bit signed integers) combining with some multiplication operations, we only expect it work properly when X and Z coordinates range within about ±2,147,000 blocks from the spawn point. This issue might happen if you go outside from this range.
Source Code
See on my GitHub repository.
Usage Terms
This project is licensed under a Creative Commons BY-SA 4.0 License.
Feel free to use and share this datapack for any public or private usages as long as: * You ensure to This datapack has no relation or source code references with that plugin. of this datapack: `flashteens` or `FTMC` when using this datapack in your public projects (ex: your Minecraft map or any derivative datapacks that use the FTMC TouchSign Datapack as a dependency.) * For those who manages to This datapack has no relation or source code references with that plugin. the FTMC TouchSign Datapack This datapack has no relation or source code references with that plugin., it is suggested that you use it This datapack has no relation or source code references with that plugin.. Do NOT re-distribute it to public This datapack has no relation or source code references with that plugin. the following scenarios: 1. The case when you are publishing another This datapack has no relation or source code references with that plugin. project (ex: a world save) that This datapack has no relation or source code references with that plugin. your modified version from the FTMC TouchSign Datapack. * For this case, please still clarify the original author in the credit sections of your post. 2. The case when you are publishing another This datapack has no relation or source code references with that plugin. project (referred to as %%MD0%%) that This datapack has no relation or source code references with that plugin. your modified version from the FTMC TouchSign Datapack (referred to as %%MD0%%). * For this case, your may provide the download links of both %%MD0%% and %%MD0%% in your post, but please focus on your datapack %%MD0%% in the description. * Datapack %%MD0%% itself This datapack has no relation or source code references with that plugin. be a modified version from on the FTMC TouchSign Datapack. * Also please clarify the original author of datapack %%MD0%% in your post. 3. Forking/cloning the source code of FTMC TouchSign Datapack to your GitHub or other source code repositories for This datapack has no relation or source code references with that plugin.. * If it is a public repository, please also clarify the original author in your descriptions. * This datapack has no relation or source code references with that plugin. NOT to be confused with This datapack has no relation or source code references with that plugin.. This datapack has no relation or source code references with that plugin. :)