Available APIs
These APIs are available in every Epitaph JRuby script.
Script Hash Structure
Section titled “Script Hash Structure”Every script is a Ruby hash assigned to script. Callbacks are lambdas inside the hash — top-level def methods do not work.
script = { name: String, # display name description: String, # tooltip text category: String, # e.g. "RENDER", "COMBAT", "MISC"
on_load: lambda do ... end, on_unload: lambda do ... end, on_enable: lambda do ... end, on_disable: lambda do ... end, on_render_2d: lambda do |event| ... end, on_render_3d: lambda do |event| ... end, on_tick: lambda do |event| ... end, on_key: lambda do |event| ... end,}API List
Section titled “API List”clientplayerworldmodulesinputfilestargetingcombatrotationfriendsteamsantibotinventoryinteractionrendermod/module_selfscript_path
client and player
Section titled “client and player”See the Client & Player guide for full documentation and examples.
Quick reference:
client.get_fps, client.get_ping, client.get_usernameclient.message(text), client.warn(text), client.error(text)client.send_chat(text), client.copy_to_clipboard(text)client.do_attack, client.do_item_useclient.random_int(min, max), client.random_float(min, max)client.now # => Integer ms timestamp
player.is_present # guard before all player callsplayer.get_id, player.get_name, player.get_display_nameplayer.get_health, player.get_max_health, player.get_absorptionplayer.get_hunger, player.get_fall_distance, player.get_hurt_timeplayer.get_x, player.get_y, player.get_zplayer.get_yaw, player.get_pitchplayer.get_velocity_x, player.get_velocity_y, player.get_velocity_zplayer.is_on_ground, player.is_sprinting, player.is_sneakingplayer.is_in_water, player.is_in_cobweb, player.is_holding_weaponplayer.can_crit, player.is_using_itemplayer.get_attack_cooldown([base_time]) # base_time default 0.5player.has_status_effect(name)player.jump, player.swingplayer.set_sprinting(bool), player.set_yaw(f), player.set_pitch(f)player.set_rotation(yaw, pitch)player.send_chat(text)world and entity objects
Section titled “world and entity objects”See the World & Entities guide for full documentation and examples.
Quick reference:
world.is_present # guard before all world callsworld.get_dimension, world.get_time, world.is_rainingworld.get_player_count, world.get_entity_countworld.get_players # => Array of entity objectsworld.get_entities # => Array of entity objectsworld.get_entity(id) # => entity or nilEntity object fields (direct access): id, name, display_name, type, x, y, z, eye_y, last_x, last_y, last_z, yaw, pitch, width, height, alive, removed, invisible, player
Entity object methods: get_id, get_uuid, get_name, get_display_name, get_type, get_x/y/z, get_eye_y, get_last_x/y/z, get_yaw, get_pitch, get_width, get_height, get_distance, get_health, get_max_health, get_hurt_time, is_player, is_living, is_hostile, is_passive, is_alive, is_removed, is_attackable, is_invisible, is_friend, is_teammate, is_bot
modules
Section titled “modules”Use this to query and control Epitaph features from Ruby.
Methods:
modules.get(name)— returns a module object or nilmodules.toggle(name)— returns new enabled statemodules.set_enabled(name, bool)— returns new enabled statemodules.is_enabled(name)— Booleanmodules.list— Array of feature name strings
Module objects expose the same methods as mod (see below), plus get_name, get_info, get_description, get_category, get_key.
mod / module_self
Section titled “mod / module_self”mod refers to the script’s own module. Use it to register settings in on_load and read them at runtime.
Registering settings (call inside on_load)
Section titled “Registering settings (call inside on_load)”mod.register_boolean_setting(name, default)mod.register_integer_setting(name, default, min, max, step)mod.register_float_setting(name, default, min, max, step)mod.register_double_setting(name, default, min, max, step)mod.register_range_setting(name, default_min, default_max, min, max, step)mod.register_mode_setting(name, default, option1, option2, ...) # options are variadic argsmod.register_string_setting(name, default)mod.register_color_setting(name, r, g, b, a)mod.register_keybind_setting(name, default_key)mod.register_separator(name)Setting visibility (call inside on_load, after registering)
Section titled “Setting visibility (call inside on_load, after registering)”# Show child only when parent equals expected_valuemod.set_setting_parent_equals(child_name, parent_name, expected_value)
# Show child only when parent does NOT equal expected_valuemod.set_setting_parent_not_equals(child_name, parent_name, expected_value)Reading and writing (call any time)
Section titled “Reading and writing (call any time)”mod.get_setting_value(name) # => value or nilmod.set_setting_value(name, value)Module state
Section titled “Module state”mod.is_enabledmod.togglemod.set_enabled(bool)mod.get_name, mod.get_info, mod.get_description, mod.get_category, mod.get_keyon_load: lambda do mod.register_double_setting("Range", 5.0, 1.0, 20.0, 0.5) mod.register_boolean_setting("Silent", false) mod.register_mode_setting("Mode", "Normal", "Normal", "Strict", "Bypass") mod.set_setting_parent_equals("Mode", "Silent", false)end,
on_tick: lambda do |_event| range = mod.get_setting_value("Range") || 5.0 silent = mod.get_setting_value("Silent") || false mode = mod.get_setting_value("Mode") || "Normal"endmod.get_info returns the same suffix text Epitaph uses in its own arraylist HUD, so scripts can render labels like Aim Assist Legit or Velocity 0%.
Arraylist HUD example
Section titled “Arraylist HUD example”feature = modules.get("Aim Assist")if feature && feature.is_enabled info = feature.get_info label = info.nil? || info.empty? ? feature.get_name : "#{feature.get_name} #{info}" render.text(label, 8, 8, render.color(255, 255, 255, 255), true)endUse this for keyboard and mouse state plus synthetic clicks.
Methods:
input.is_key_down(keycode)— Boolean (GLFW keycode)input.is_mouse_down(button)— Boolean (GLFW mouse button)input.is_attack_pressed,input.is_use_pressed,input.is_jump_pressedinput.is_forward_pressed,input.is_back_pressed,input.is_left_pressed,input.is_right_pressed,input.is_sneak_pressedinput.mouse_press(button),input.mouse_release(button)input.mouse_click(button, [millis])— millis defaults to 35input.left_click([millis]),input.right_click([millis])
targeting
Section titled “targeting”These methods check the crosshair target directly. None of them take arguments.
targeting.get # => hit result table or niltargeting.get_type # => "entity", "block", or "miss"targeting.is_entity # => Booleantargeting.is_block # => Booleantargeting.is_miss # => Booleantargeting.get_entity # => entity object or niltargeting.get_block # => block hit object or nilHit result table (from targeting.get): type, is_entity, is_block, is_miss, x, y, z, entity (when entity), entity_id (when entity), block (when block)
Block hit object: x, y, z (Integer block pos), side (String face), hit_x, hit_y, hit_z (Float exact position)
Raycasts (yaw and pitch are optional, default to player rotation):
targeting.raycast(reach)targeting.raycast(reach, yaw, pitch)targeting.raycast_through_walls(reach)targeting.raycast_through_walls(reach, yaw, pitch)combat
Section titled “combat”Lightweight combat helpers:
combat.get_attack_cooldown([base_time])— Float 0.0–1.0combat.can_crit— Booleancombat.is_in_water,combat.is_in_cobweb— Booleancombat.is_holding_weapon— Booleancombat.can_swing— Boolean
rotation
Section titled “rotation”Aim assistance helpers for calculating rotations to entities and positions.
Rotation calculations
Section titled “Rotation calculations”rotation.get_rotation_to(entity) # => {yaw, pitch, x, y, z}rotation.get_rotation_to(block) # block hit / block-pos table with x,y,zrotation.get_rotation_to(x, y, z) # exact world position
rotation.get_rotation_to_entity(entity) # alias with explicit namingrotation.get_rotation_to_entity(entity, "Head")rotation.get_rotation_to_entity(entity, "Body", 50.0) # multipoint accuracy 0-100rotation.get_rotation_to_block(block)rotation.get_rotation_to_block(x, y, z)
rotation.get_to_entity(entity) # legacy aliasrotation.get_to_entity(entity, "Head")rotation.get_to_entity(entity, "Body", 50.0)rotation.get_to_position(x, y, z)rotation.get_to_block(block)rotation.get_to_block(x, y, z)Rotation result tables include yaw, pitch, x, y, and z.
Angle and distance
Section titled “Angle and distance”rotation.get_angle_diff(entity) # => {yaw, pitch, total} degreesrotation.get_yaw_diff(entity) # => Float yaw diff (-180 to 180)rotation.get_pitch_diff(entity) # => Float pitch diff in degreesrotation.get_abs_angle_diff(entity) # => Float combined Euclidean diffrotation.apply_gcd(current, target) # => Float target snapped to Minecraft mouse GCDrotation.get_distance_to(entity) # => Float distance in blocksUse rotation.apply_gcd(current, target) when you want script-driven yaw or pitch changes to respect the same mouse-step snapping used by the client’s rotation features.
friends, teams, antibot
Section titled “friends, teams, antibot”friends.is_friend(name_or_entity) # => Booleanfriends.list # => Array of String names
teams.is_enabled # => Booleanteams.is_teammate(entity) # => Boolean
antibot.is_enabled # => Booleanantibot.is_bot(entity) # => Booleaninventory
Section titled “inventory”inventory.get_selected_slot # => Integer 0–8inventory.can_change_held_slot # => Booleaninventory.set_selected_slot(slot, [silent])inventory.try_set_selected_slot(slot, [silent]) # => Boolean successinventory.get_slot(index) # => slot object or nilinventory.get_hotbar # => Array of slot objects (0–8)inventory.find_hotbar_slot(query) # => Integer or -1 (matches item_name or display_name)inventory.click_slot(slot, [button], [action_type])Slot object fields: slot, container_slot, empty, count, item_name, display_name, is_hotbar
action_type string values: "pickup" (default), "quick_move", "swap", "clone", "throw", "quick_craft", "pickup_all"
interaction
Section titled “interaction”interaction.attack_entity(entity_or_id)interaction.interact_entity(entity_or_id, [hand]) # hand: "main" or "off", default "main"interaction.interact_item([hand])interaction.stop_using_iteminteraction.attack_block(x, y, z, [face]) # face: "up","down","north","south","east","west"interaction.interact_block(x, y, z, [face], [hand])render
Section titled “render”See the Rendering guide for full documentation and examples.
Key signatures:
render.color(r, g, b, a) # all four 0–255 requiredrender.fill(x1, y1, x2, y2, color) # absolute max coordsrender.border(x, y, width, height, color) # origin + dimensionsrender.text(text, x, y, color, [shadow]) # x,y are Integer; shadow default falserender.measure_text(text) # => Integer widthrender.font_text(font, text, x, y, size, color, [shadow])render.measure_font_text(font, text, size) # => Floatrender.font_height(font, size) # => Floatrender.list_fonts # => Array of Stringrender.entity_screen_box(entity_or_id, [padding]) # => box or nilrender.world_to_screen(x, y, z) # => {x, y, depth, on_screen} or nilrender.is_2d_context, render.is_3d_contextrender.line_3d(x1,y1,z1, x2,y2,z2, color, [through_blocks], [line_width])render.box_3d(x1,y1,z1, x2,y2,z2, color, [through_blocks], [line_width])render.filled_box_3d(x1,y1,z1, x2,y2,z2, color, [through_blocks])render.circle_3d(x,y,z, radius, color, [through_blocks], [line_width])Scoped to the Epitaph scripts directory. Paths outside it are rejected.
files.root # => String absolute path to scripts dirfiles.exists(path) # => Booleanfiles.read(path) # => String or nilfiles.write(path, content)files.append(path, content)files.mkdirs(path)files.list([path]) # => Array of relative path strings; defaults to root