Skip to content

game

These function(s) are used for gathering or setting informaton from Minecraft. Most of these functions will NOT have a description because they are self-explanatory.

is_in_fov

Description

This will check if an entity is within an FOV range. This will also return any calculated angles and the result of the FOV check in the case it fails. The Reach script shows an example of how the x and z returned values are used.

Parameters

  • number
  • number
  • number

Returns

  • boolean
  • number x_angle
  • number z_angle
  • number actual_fov_yaw_difference
  • number actual_fov_pitch_difference

Example

Lua
1
2
3
4
5
6
7
local result, angle_x, angle_z, true_fov_yaw, true_fov_pitch = parallatic.game.is_in_fov( localplayer, entity, 45.5 )
if not result then
    parallatic.log( entity["name"] .. " was not in the FOV range. They are actually " .. true_fov_yaw .. " FOV. This is higher than your input.")
    return
end

parallatic.log( entity["name"] .. " is in your FOV!" ) 

get_player

Description

This will get the player/entity and some vital data.

Parameters

  • number

Returns

  • get_xp

    • This gets the experience amount. Not the level.
  • get_name

  • get_index

    • You can either use this function or simply access the index member.
  • get_hurt_time

    • The duration the entity is being hurt for.
  • get_recently_hit

    • Get time entity was recently hurt.
  • get_last_attacker

    • This will get the index of the entity that last attacked this entity.
  • get_last_attacker_time

    • Get time entity was recently attacked by another entity.
  • get_last_damage

    • The last amount of damage that was taken.
  • get_eye_height

  • get_position

    • table ->
    • number x
    • number y
    • number z
  • get_motion

    • table ->
    • number x
    • number y
    • number z
  • get_air_speed

    • This tends to be a static value.
  • get_ground_speed

    • This tends to be a static value.
  • get_armor_value

  • get_swing_progress

  • get_forward

  • get_strafing

  • get_ping

    • Sometimes inaccurate or dysfunctional.
  • is_user

  • is_alive

  • get_closest_entities( number )

    • table entities

Example

Lua
1
2
3
4
local player_information = parallatic.game.get_player( localplayer )
if not player_information then return end

parallatic.log("You have " .. player_information:get_health() .. " health!")

trace_ray_blocks

Description

This function will perform a TraceRay of an entity to depending on the distance. If the trace is successful, this function returns the x, y, z position of the block.

Parameters

  • number entity
  • number reach_distance
  • number ticks

Returns

  • boolean
  • number x
  • number y
  • number z

Example

Lua
1
2
3
4
5
6
7
local hit_block, x, y, z = parallatic.game_trace_ray_blocks( localplayer, 50.0, 20 )
if not hit_block then
    parallatic.log("We didn't hit anything.")
    return
end

parallatic.log("We hit a block at " .. x .. ", " .. y .. ", " .. z )

trace_ray_mouse

Description

This function will perform a TraceRay based on your mouse position. This is determined by Minecraft returning whether your mouse is over an object or not. This only works with the local player. The type_hit represents the enumeration MovingObjectPosition.MovingObjectType.

This function seemingly does not return an entity. This has been reported multiple times with older Minecraft versions. However, you can use this function with parallatic.game.is_in_fov and the distance function instead of this. I would not personally consider this function reliable.

Returns

  • number entity
  • number type_hit
  • number x
  • number y
  • number z

Example

Lua
1
2
3
4
5
6
7
local entity, hit_type, x, y, z = parallatic.trace_ray_mouse( localplayer, 50.0, 20 )
if hit_type == HIT_TYPE_NONE then
    parallatic.log("We didn't hit anything.")
    return
end

parallatic.log("Our mouse appears to be over something at " .. x .. ", " .. y .. ", " .. z )

get_players

Description

This creates a nested table of parallatic.game.get_player of players on the server. (not entities)

Returns

  • table

Example

Lua
1
2
3
for _, player in pairs( parallatic.game.get_players() ) do 
    parallatic.log( player["name"] )
end

get_entities

Description

This creates a nested table of parallatic.game.get_player of entities on the server. Players ARE included. This will get all entities. This includes dropped items, mobs, experience orbs, etc.

Returns

  • table

Example

Lua
1
2
3
for _, player in pairs( parallatic.game.get_entities() ) do 
    parallatic.log( player["name"] )
end

is_using_item

Description

If the item can be right used, this will return true. This will always return true regardless of the transaction and item that is being used.

Parameters

  • number

Returns

  • boolean

Example

Lua
1
2
3
if parallatic.game.is_using_item( localplayer ) then
    parallatic.log("Are you eating? Blocking? What are you doing with this item right now?")
end

is_blocking

Description

This will check if an entity is blocking.

Parameters

  • number

Returns

  • boolean

Example

Lua
1
2
3
if parallatic.game.is_blocking( localplayer ) then
    parallatic.log("Defend yourself.")
end

is_spectator

Description

This will check if an entity is spectating.

Parameters

  • number

Returns

  • boolean

is_invisible_to_player

Description

This will check if an entity is invisible to another player.

Parameters

  • number
  • number

Returns

  • boolean

Example

Lua
1
2
3
if parallatic.game.is_spectating_player( entity, localplayer ) then
    parallatic.log("This entity can't see you.")
end

is_spectating_player

Description

This will check if an entity is spectating another entity.

Parameters

  • number
  • number

Returns

  • boolean

Example

Lua
1
2
3
if parallatic.game.is_spectating_player( localplayer, entity ) then
    parallatic.log("You're watching another player right now.")
end

is_in_bed

Description

This will check if an entity is in bed.

Parameters

  • number

Returns

  • boolean

is_wet

Parameters

  • number

Returns

  • boolean

is_sneaking

Parameters

  • number

Returns

  • boolean

is_riding

Description

This will check if an entity is riding anything.

Parameters

  • number

Returns

  • boolean

is_in_water

Parameters

  • number

Returns

  • boolean

is_jumping

Parameters

  • number

Returns

  • boolean

is_airborne

Parameters

  • number

Returns

  • boolean

is_on_ground

Parameters

  • number

Returns

  • boolean

is_sprinting

Parameters

  • number

Returns

  • boolean

is_eating

Parameters

  • number

Returns

  • boolean

is_burning

Parameters

  • number

Returns

  • boolean

is_in_lava

Parameters

  • number

Returns

  • boolean

is_invisible

Parameters

  • number

Returns

  • boolean

get_bounding_box

Description

Gets the bounding box of an entity. The Reach script shows an example of how this is used.

Parameters

  • number

Returns

  • number
  • number
  • number
  • number
  • number
  • number
  • number

set_bounding_box

Description

Sets the bounding box of an entity. The Reach script shows an example of how this is used.

Parameters

  • number
  • number
  • number
  • number
  • number
  • number
  • number

set_angles

Description

This sets the pitch and yaw of the localplayer.

Parameters

  • number
  • number

set_rotation

Description

This sets the rotation of the localplayer.

Parameters

  • number
  • number

set_velocity

Description

This sets the velocity of the localplayer.

Parameters

  • number
  • number
  • number

get_health

Description

It's better to use parallatic.game.get_player to get this instead. It's already included in the return table.

Parameters

  • number

Returns

  • number

get_entity_name

Description

It's better to use parallatic.game.get_player to get this instead. It's already included in the return table.

Parameters

  • number

Returns

  • string

get_horse_jump_power

Description

This will get the horse the entity is riding's jumping power.

Parameters

  • number

Returns

  • number

get_inventory

Description

This function will get all items in your inventory and its qualities as a nested table. This function is not completed and as a result will be missing documentation.

Parameters

  • number

get_item_in_slot

Description

This will get an item in a specific slot in your inventory. The first parameter is seeking the slot number. See this for the slot numbers.

Parameters

  • number

Returns

  • table -->
  • string name
  • string raw_name

set_item_in_slot

Description

This will move an item from 1 slot in your inventory to another slot. See this for the slot numbers.

Parameters

  • number
  • number

get_yaw

Description

Gets the yaw of an entity.

Parameters

  • number

Returns

  • number

get_pitch

Description

Gets the pitch of an entity.

Parameters

  • number

Returns

  • number

get_hotbar_slot

Description

This will return what hotbar slot is currently active.

Returns

  • number

jump

Description

Jumps your localplayer.


set_pitch

Description

This sets the pitch of the localplayer.

Parameters

  • number

set_yaw

Description

This sets the yaw of the localplayer.

Parameters

  • number

get_motion

Description

Gets the motion of an entity.

Parameters

  • number

Returns

  • number
  • number
  • number

is_focused

Description

This function checks whether any GUI or menu is open. This function will return true if your player is able to move, look, interact with the world, etc. Otherwise or if any GUI or menu is open, this will return false.

Returns

  • boolean

is_paused

Description

Checks whether the game is paused or not.

Returns

  • boolean

is_gui_enabled

Description

Checks whether a gui is enabled or not.

Returns

  • boolean

is_fullscreen

Description

Checks whether the game is in fullscreen or not.

Returns

  • boolean

is_singleplayer

Description

Checks whether you are in singleplayer or not.

Returns

  • boolean

can_attack_player

Description

Checks whether you can attack a player or not.

Parameters

  • number

Returns

  • boolean

attack_entity

Description

Automatically attacks an entity for you. This will not trigger the attacking animation and will only work if you are within reach distance.

Parameters

  • number

is_survival_or_adventure

Description

Checks whether you are in survival or adventure mode.

Returns

  • boolean

is_reach_extended

Description

Checks whether the server extended the reach of your player.

Returns

  • boolean

is_spectator_mode

Description

Checks whether you are in spectator mode.

Returns

  • boolean

is_hitting_block

Description

Checks whether you are hitting a block. This only works with blocks that don't automatically break in one hit. Creative mode does this automatically.

Returns

  • boolean

get_reach_distance

Description

Gets the reach distance of your player.

Returns

  • number