[Tutorial] Math Utils [WIP]

Started by sumeshi0216 on

Topic category: User side tutorials

Last seen on 10:54, 29. Jun 2024
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] Math Utils [WIP]
Thu, 06/27/2024 - 12:26 (edited)

Features

Math Utils adds the following variables.

  • Random Source
  • Vector
  • Vector List
  • Vector Map

 

Random Source

Random Source is a variable required to generate random numbers.

In order to generate random numbers,  you will need to create a random source. If the source is used without creating, errors will occur.

The seed is a number required to calculate random numbers, and it can fixes the sequence of those.

 

Next, get random numbers with the source.

Note that random numbers are not automatically synchronized between client and server side.

 

Vector

Vector is a variable which can have 3 numbers as X, Y and Z value.

In order to create a vector from numbers, do it like this. If a vector is not created, a zero vector (x, y, z) = (0, 0, 0) is used as an initial value.

For yaw and pitch values, vectors follow Minecraft's coordinate system.

 

These procedures can get each of numbers.

 

To do easy operations for vectors, these procedure are available.

The operations are done for each X/Y/Z component of numbers in vectors. For example, "(0, 1, 2) + (3, 4, 5)" is "(3, 5, 7)."

 

Vector List

Vector List can store vectors using index numbers.

You will need to create a vector list at first. If the list is used without creating, errors will occur.

 

Vector Map

Vector map can store vectors using string keys.

You will need to create a vector map at first. If the map is used without creating, errors will occur.

The load factor is a reference value to expand the map.

When the current size reaches the maximum size * the load factor, the map size will be expanded.

Edited by sumeshi0216 on Thu, 06/27/2024 - 12:26