Vector - MinecraftPhi/MinecraftPhi-modules GitHub Wiki

This module adds functions for manipulating vectors, which are 3 numbers x, y, z. When stored in NBT it is stored as a list of length 3 in the same order. When stored as scores the three components have the same name but with .x, .y, or .z on the end of the fakeplayer name. Currently there are only functions for getting and setting certain vectors, but there will be arithmetic in the future.

Functions

  • phi.vector:get_look_nbt, gets the look vector of the @s entity. This is a vector with a length of 1 and is pointing in the direction the entity is looking. The vector is stored in storage phi.vector:temp look
  • phi.vector:get_look_scores same as phi.vector:get_look_nbt but stores the vector in three scores $phi.vector.look temp, with a scale of 2147483647
  • phi.vector:set_look sets the look vector of @s entity using the vector at storage phi.vector:temp look. This works for entities as well as players
  • phi.vector:get_pos_nbt, gets the position of the @s entity. The vector is stored in storage phi.vector:temp pos
  • phi.vector:get_pos_scores same as phi.vector:get_pos_nbt but stores the vector in three scores $phi.vector.pos temp, with a scale of 71. It is not recommended to use this function, because the scale is quite small to support all possible positions. In the future this may be changed to use software floating point.
  • phi.vector:set_pos sets the position of the @s entity using the vector at storage phi.vector:temp pos. This works for entities as well as players