Data Packs Other

Trigonometry (Library)

    • 1,530 views • 16 today
    • 91 downloads • 0 today
    • 5
    • 3
    • 2
    Diagamez
    Level 35 : Artisan Miner
    14
    Math in Minecraft is horrible! It's really hard to do anything more complicated than simple addition, subtraction, multiplication and division. This is why I made this datapack that 'calculates' sines, cosines, tangents, etc.

    How to calculate sine, cosine or tangent:

    Set the input value to your angle (in degrees).
    /scoreboard players set input gon A

    Run the function input_angle to do some calculations before the sine, cosine or tangent can be calculated
    /function gon:input_angle

    Run your desired operation!
    /function gon:sin with storage gon:input
    /function gon:cos with storage gon:input
    /function gon:tan with storage gon:input

    Your result (with all decimals) will be stored within the storage 'gon:output' in the nbt tag 'output'
    /data get storage gon:output output
    
    How to calculate the angle with the sine, cosine or tangent as input:

    Set the input to your sine, cosine or tangent times 1000. This code needs 3 decimal places to correctly determine the angle with an accuracy of 1°
    /scoreboard players set input gon A

    Run your desired operation!
    /function gon:arcsin
    /function gon:arccos
    /function gon:arctan

    Your result will be stored within the storage 'gon:output' in the nbt tag 'output'
    /data get storage gon:output output
    CompatibilityMinecraft 1.21
    Tags

      Have something to say?

    Titruc
    01/19/2025 10:08 am
    Level 75 : Legendary Cake
    ok that cool ! if you don't need super precise value than fine
    1
    Diagamez
    01/19/2025 1:08 pm
    Level 35 : Artisan Miner
    The sines, cosines and and tangents have a lot of decimals, but the angles only go to 1°
    1

    Welcome