Racing Gates, Timekeeping & Path Marking with flowers (2024)

Racing Gates, Timekeeping & Path Marking with flowers (1)

A datapack with gates in different sizes and pointing into different directions, with redstone timekeeping and an easy to use py-script to set flowers to mark the way

GoogleDrive-Download-Link for the Package: https://drive.google.com/drive/folders/1cKsxvbaRWgDQoewymMB6is630BwfgBu2?usp=drive_link

As used in my „CeBit Hannover“-Map (also diagonally positioned gates are possible and all gates are also placeable in an „iceboat version“, meaning that there’s no bottom frame so you can drive through.

The datapack also contains a ticked function which counts seconds. The gates got commandblocks in the floor to detect you flying through.

Lap-Counter-Demo:

If Lapcounter-Sidebar does not appear, activate it manually:
/scoreboard objectives setdisplay sidebar laps
For clearer chat output I disabled command output (else it will be spammed with background status information about running functions). Gate1-function does this:
/gamerule sendCommandFeedback false („true“ is you want to turn it back on)

1_SPAWNING THE GATES

2_GATE-CODE
3_FUNCTION-CODE

4_FIRST GATE (first and last gate are special)
5_LAST GATE (first and last gate are special)

6_TICKED FUNCTION
7_MARKING THE PATH
8_OTHER GATE DESIGNS

Reset-Command
the set the Timer and Laps back to 0 simply run the „reset“-function (\function namespace:resetrace).

SPAWNING THE GATES

(text color = parameters to adapt to your individual project)

Paste a gate with the /function which is named after the respective cardinal direction you need: For example „gate_ston_small“ would lie on the axis from „S to N“, south to north (with its Opening pointing from E to W).

The Command Block and its command are automatically pasted with it.
You’d just have to adapt every Gate’s code to your project’s needs to make it work (see below)


GATE – CODE

/execute if entity @p[dy=4, dx=2, dz=2] run function namespace:gate17 *

This checks whether the gate is passed or not and then calls the respective function. E.g. Gate17’s command calls the function called „gate17.mcfunction“ which you’d have to create in the datapack (copy&past then adapt).
Be aware that big and medium gates got multiple command blocks to change, so they all point to the right .mcfunction.

FUZZINESS WORKAROUND: I added „dx=2, dz=2“ (enlarges detection area) because without that the gates sometimes did not count me flying through with a FPV-Drone. It however now counts you even if you closely miss. This could be improved.

FUNCTION – CODE

scoreboard players set @p gate17 1

This command inside of the function sets the gate17 variable from 0 (=false) to 1 (=true) meaning that the gate was passed.

btw the functions also play a sound (that you could change there) when the player passes the gate:

playsound minecraft:block.note_block.bit ambient @p

FIRST GATE STARTS RACE

The first gate does an additional job: It starts the race counter by setting the variable „racedidstartornot“ to 1 (=true).

scoreboard players set dummyPlayer racedidstartornot 1

LAST GATE CHECKS IF ALL PASSED

The last gate’s function checks if all previous gates were passed

execute if entity @p[dy=4, dx=2, dz=2] unless score @p gate2 matches 0 unless score (…) unless score @p gate18 matches 0 run function namespace:finish

if all gates were passed, it calls the function named „finish“ which counts your lap as finished

Adapt the above code to the exact number of gates you want to check.

FINISH – FUNCTION
It outputs the time and the laps.
And it resets the gates from 1 („passed“) to 0 („not passed“)

scoreboard players set @p gate1 0
scoreboard players set @p gate2 0

scoreboard players set @p gate99
0

Adapt the above code to the number of gates you want.

TICKED FUNCTION
A „ticked function“ is a Minecraft function that is constantly clocking – every „tick“ (1/20 of a second) it is executed.

Our ticked function opens variables for every gate. If you need more gates, add more entries here.

„scoreboard objectives add gate<gatenumber> dummy“

Marking the Path

pathmarkingflowers.py Python script can calculate a list of setblock commands to mark a way between two (or more) positions in your world with e.g. flowers. (Running Python scripts is not difficult. Here I explain how to execute a Py-Script here, as part of my other tutorial, where it is needed, too (chapter „How to run Python scripts?„).)

This is the Pathmarking script, which is part of the „Race Timekeeping, Gates and Waymarking“-„bundle“ so to say:

https://drive.google.com/file/d/1uEDV_smmQIpzZwJIEGrtjIhBHopfnlff/view?usp=sharing

The script will calculate the intermediate waypoints on the way inbetween from start position A to middle positions B, C D … to end position Z.

How to use it?

enter:

„/data get entity @s Pos“
or
„/teleport ~ ~ ~“

to Minecraft to get your momentary position. Go to the next waypoint in a more or less straight line and execute the command again to mark a waypoint when a turn arrives. Then you have to set some new waypoints to mark it. The coords will be written in „logs/latest.log“

You can now copy&paste to logs into „input.txt“*. Please do not include any additional lines into „input.txt“, not even empty ones, just the ones with the coordinates else the script cannot work. This is how input.txt could look:

[01:49:50] [Render thread/INFO]: [CHAT] VeganDelicious84 has the following entity data: [-225.3960170269811d, 33.93702159613858d, -11.004493481495018d]
[01:49:50] [Render thread/INFO]: [CHAT] VeganDelicious84 has the following entity data: [-245.3960170269811d, 9.93702159613858d, -21.004493481495018d]
[01:49:50] [Render thread/INFO]: [CHAT] VeganDelicious84 has the following entity data: [-325.3960170269811d, 100.93702159613858d, -31.004493481495018d]


(example with 3 key waypoints)

Now run pathmarkingflowers.py and it will output „output.txt“ which contains all calculated flowers inbetween your waypoints:

execute if block -225 34 -11 air run setblock -225 34 -11 cornflower
execute if block -232 26 -14 air run setblock -232 26 -14 cornflower
execute if block -239 18 -18 air run setblock -239 18 -18 cornflower
execute if block -245 10 -21 air run setblock -245 10 -21 cornflower
execute if block -245 10 -21 air run setblock -245 10 -21 cornflower

execute if block -245 10 -21 air run setblock -245 10 -21 cornflower
execute if block -252 18 -22 air run setblock -252 18 -22 cornflower
execute if block -259 26 -23 air run setblock -259 26 -23 cornflower
execute if block -266 34 -24 air run setblock -266 34 -24 cornflower
execute if block -274 42 -25 air run setblock -274 42 -25 cornflower
execute if block -281 50 -25 air run setblock -281 50 -25 cornflower
execute if block -288 58 -26 air run setblock -288 58 -26 cornflower
execute if block -295 66 -27 air run setblock -295 66 -27 cornflower
execute if block -302 74 -28 air run setblock -302 74 -28 cornflower
execute if block -309 82 -29 air run setblock -309 82 -29 cornflower
execute if block -316 90 -30 air run setblock -316 90 -30 cornflower
execute if block -323 98 -31 air run setblock -323 98 -31 cornflower
execute if block -325 101 -31 air run setblock -325 101 -31 cornflower

In the example I had flowerdistance set to 8 (=1 flower every 8 blocks) and the blocktype to „cornflower“. The coordinates are rounded.

Just for more clarity it outputs paragraphs: paragraph 1 is the way between key waypoint 1 to key waypoint 2. paragraph 2 is the way from key waypoint 2 to key waypoint 3 etc. However you can copy & paste all paragraphs at once into your minecraft datapack function*, start Minecraft and run the function with „/function <functionname>“.

The flowers can’t overwrite a your building’s blocks because the command generated by the script can only set flowers into „air“ blocks

*Function names must be typed in lower case.

If you want wider distances between the flowers you can set that by the variable at the top of script (flowerdistance = 2 would mean that a flower is set every 2nd block).

If you want other flowers or (any other block) simply change the blocktype = azure_bluet

Troubleshooting:
Strange error messages like „float() wrong value“, „string etc.“ often means you got a superfluous page break in „input.txt“ or some other interfering character.

Those errors are occurring bc the script received coordinates it couldn’t process. Normally the script is made to cut away everthing uncecessary that is normally found on the same line as the coords in the log. But maybe you got another Quotation mark in your text software than the anticipated one, then it cannot find the right coordinates because everything is shifted and so the script tries to calculate with some other value it happens to get. I think it’s like if we humans would be told to calculate e.g. „513 + grey concrete – ¥„.

Just remove those error sources/superfluous symbols and it should work, or freshly copy&paste the coords.

Other Gate Designs

In folder „iceboatVersionofGates“ I included versions of the gates that are more suited for iceboat racing as they dont have the bottom frame bar so you can drive through.

just replace the gate-mcfunctions in the current datapack by these altenative ones:

Folder „bottomless_IceboatVersionGates“
Folder „topbottomless_IceboatVersionGates“ (also no top bar)
Folder „topbottomless_RedVersionGates“ (red and white colour)

YOUR OWN COLOUR SCHEME:
it would be easy to just change the colour scheme to your liking by using search and replace in your favourite text editor (or with the following Python text replacer tool which can replace a word in multiple files of a folder: https://drive.google.com/file/d/1qzQ5sMu9nGAhT5YtkgfMzwkG6bP872gB/view?usp=sharing )

Racing Gates, Timekeeping & Path Marking with flowers (2024)

References

Top Articles
Latest Posts
Article information

Author: Domingo Moore

Last Updated:

Views: 6335

Rating: 4.2 / 5 (73 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Domingo Moore

Birthday: 1997-05-20

Address: 6485 Kohler Route, Antonioton, VT 77375-0299

Phone: +3213869077934

Job: Sales Analyst

Hobby: Kayaking, Roller skating, Cabaret, Rugby, Homebrewing, Creative writing, amateur radio

Introduction: My name is Domingo Moore, I am a attractive, gorgeous, funny, jolly, spotless, nice, fantastic person who loves writing and wants to share my knowledge and understanding with you.