render
MC字符串高度为9
rect
render.rect(float x, float y, float width, float height, int rgb)
line
render.line(float x1, float y1, float x2, float y2, float width, int rgb)
image
render.image(string base64) : Image
data:image/png;base64,
这个文字头是可选的,没有也不会影响渲染
示例:
function on_render_screen(event)
local image = render.image("图片Base64")
image:render(0,0,64,-1)
end
get_delta
render.get_delta() : long
string
render.string(string text, float x, float y, int rgb, boolean shadow)
get_string_width
render.get_string_width(string text) : int
draw_string
render.draw_string(string font, string text, float x, float y, int rgb, boolean shadow)
render.draw_string("微软雅黑", "Hello World!", 1, 1, -1, false)
string_width
render.string_width(string font, string text) : int
font_height
render.font_height(string font) : int
player_head
render.player_head(float x, float y, float size, int entityID)
round_player_head
render.round_player_head(float x, float y, float size, int entityID,float radius)
draw_bounding_box
render.draw_bounding_box(int entityID, int color, int alpha)
function on_render_world()
local list = world.entities()
for i = 1, #list do
local entindex = list[i]
render.draw_bounding_box(entindex,-1,100)
end
end
world_to_screen
render.world_to_screen(int entityId) : Vector2D
block_world_to_screen
render.block_world_to_screen(BlockPos pos, string render_function)
entity_world_to_screen
render.entity_world_to_screen(int entityId,string render_function)
这两个方法得到的回调函数参数均为(double x, double y, double width, double height)
示例
function on_render_screen(event)
render.block_world_to_screen(player.create_position(0,4,0),"callback_method");
render.entity_world_to_screen(player.id(),"callback_method");
end
function callback_method(x,y,w,h)
render.rect(x,y,w,h,0x56FFFFFF);
end
setup_camera_transform
render.setup_camera_transform(float partialTicks)
setup_overlay_rendering
render.setup_overlay_rendering()
init_stencil
render.init_stencil()
read_stencil
render.read_stencil()
end_stencil
render.end_stencil()
item_stack
render.item_stack(ItemStack stack, float x, float y);