simon816 / Command-Block-Assembly

Compile high-level code into Minecraft commands
https://www.simon816.com/minecraft/assembler
MIT License
271 stars 29 forks source link

Computing Coordinates #5

Closed Loumardes closed 5 years ago

Loumardes commented 5 years ago

You can convert coordinates to scoreboard values and scoreboard values to coordinates in Minecraft :

To scoreboard :

execute as @e store result score @s Xcoordinates run data get entity @s Pos[0] 1

To coordinates :

_execute store result entity @e[tag=memoryentity,limit=1] Pos[0] double 1 run scoreboard players get @s Xcoordinates

In NBT format : Pos[0] : X Pos[1] : Y Pos[2] : Z

Same with rotation in degrés : Rotation[0] : player course Rotation[1] : inclination

I think assembly instructions may be useful Hope it will help

simon816 commented 5 years ago

This is something I've been meaning to do. It's only been possible since 1.13, the old way I set a position was to tp in a loop that shifted the entity.

simon816 commented 5 years ago

This is being implemented in my new language called CBL: https://github.com/simon816/Command-Block-Assembly/blob/1e30140344ae91e6952c3543606794791d1a658e/cbl/entity_support.py#L86-L214

It's still in early development but it will work something like this:

entity.pos = (10, 10, 10);
entity.pos.x += some_value;
entity1.pos = entity2.pos;
FinnT730 commented 5 years ago

looks amazing! Don't know where else to put this, but this is one of the better tools for something like this out there! Thanks for making it, and I hope you will continue with it!