该模组引入了 2 个方块和 1 种物品,让你能够建造并控制自己的数字屏幕。使用计算机,你可以编写程序来显示内容,绘制任何你想要的东西——从简单的文本到复杂的图形。
特性:
显示方块 – 用于渲染你图形的屏幕
控制器方块 – 将其连接到计算机以发送代码并控制显示
导线物品 – 使用正极 (+) 和负极 (–) 导线连接各个组件
通过 Displadium,你可以:
创建自定义界面和 HUD
显示图像、文本或动画
构建你自己的游戏内控制面板
在 Minecraft 中进行编程实验
布线系统允许你真实地连接方块,需要正确的正负极连接才能正常工作。
教程
以下是所有可用的 Lua 命令列表、它们在代码中的实现方式以及确切的使用示例。
所有可用命令
tick(t, dt) — 引擎在每个 tick 调用的函数。t 是时间(秒),dt 是经过 speed() 调整的时间步长。
point(x, y) — 设置点 (x, y) 的位置,范围在 0..1 之间。
emit(x, y [, color [, glow [, size]]]) — 将点添加到轨迹中,支持可选参数。颜色支持 #RRGGBB、数值或 r,g,b 格式。
line(x1, y1, x2, y2 [, steps [, color [, glow [, size]]]]) — 使用点绘制直线。steps 限制为 2..200。
rotline(cx, cy, length, angle [, steps [, color [, glow [, size]]]]) — 使用中心点、长度和角度(弧度)绘制直线。
color(#RRGGBB) 或 color(r, g, b) — 设置颜色。r,g,b 的范围可以是 0..1 或 0..255。
glow(value) — 亮度,最小值为 0。
size(value) — 点大小,最小值为 0.05。
alpha(value) — 透明度(0..1)。
speed(value) — 时间速度,最小值为 0.05。
trail(count) — 轨迹长度(10..400)。
subtick(value) — 轨迹插值(1..20)。
show(true/false) — 启用或禁用渲染。
time() — 返回当前时间 t(已应用 speed)。
确切规则与限制
坐标 x 和 y 始终被钳制在 0..1 范围内。
颜色可以是 #RRGGBB 字符串、数值或三个分量 r,g,b(0..1 或 0..255)。
glow ≥ 0,size ≥ 0.05,alpha 0..1,speed ≥ 0.05,trail 10..400,subtick 1..20。
line / rotline:steps 限制为 2..200。
使用方法
使用导线连接计算机和显示器(+ 和 - 都必须连接到同一台计算机)。
打开计算机界面,将你的 Lua 代码粘贴到字段中,然后按“保存”。
脚本加载后,tick(t, dt) 函数会在每个客户端 tick 时被调用。
示例(完全准确且可运行)
function tick(t, dt) speed(1.0) trail(120) subtick(6) alpha(0.9) glow(1.2) size(1.0) local x = 0.5 + math.cos(t * 1.3) * 0.35 local y = 0.5 + math.sin(t * 1.3) * 0.35 point(x, y) color("#66CCFF") emit(x, y) local angle = t * 2.0 rotline(0.5, 0.5, 0.7, angle, 30, 1.0, 0.5, 0.2) end
示例工作原理
tick 在每个 tick 时被调用,t 是以秒为单位的时间(受 speed 影响)。
point 使主点在圆周上移动。
emit 添加具有选定颜色/亮度的轨迹。
rotline 围绕中心绘制旋转的直线。
The mod introduces 2 blocks and 1 item that allow you to build and control your own digital screens. Using a computer, you can program the display and draw anything you want — from simple text to complex graphics.
Features:
Display Block – a screen where your graphics are rendered
Controller Block – connect it to a computer to send code and control the display
Wire Item – connect components using positive (+) and negative (–) wires
With Displadium, you can:
Create custom interfaces and HUDs
Display images, text, or animations
Build your own in-game control panels
Experiment with programming inside Minecraft
The wiring system allows you to connect blocks realistically, requiring proper positive and negative connections to function.
TUTORIAL
Below is the full list of available Lua commands, how they are implemented in the code, and an exact usage example.
All available commands
tick(t, dt) — a function called by the engine every tick. t is time in seconds, dt is the time step adjusted by speed().
point(x, y) — sets the position of a point (x, y) within the 0..1 range.
emit(x, y [, color [, glow [, size]]]) — adds a point to the trail with optional parameters. Supports color as #RRGGBB, a number, or r,g,b.
line(x1, y1, x2, y2 [, steps [, color [, glow [, size]]]]) — draws a line using points. steps is limited to 2..200.
rotline(cx, cy, length, angle [, steps [, color [, glow [, size]]]]) — draws a line using center, length, and angle (in radians).
color(#RRGGBB) or color(r, g, b) — sets the color. r,g,b can be in range 0..1 or 0..255.
glow(value) — brightness, minimum 0.
size(value) — point size, minimum 0.05.
alpha(value) — transparency (0..1).
speed(value) — time speed, minimum 0.05.
trail(count) — trail length (10..400).
subtick(value) — trail interpolation (1..20).
show(true/false) — enables or disables rendering.
time() — returns current time t (with speed applied).
Exact rules and limits
Coordinates x and y are always clamped to 0..1.
Color can be a #RRGGBB string, a number, or three components r,g,b (0..1 or 0..255).
glow ≥ 0, size ≥ 0.05, alpha 0..1, speed ≥ 0.05, trail 10..400, subtick 1..20.
line / rotline: steps is limited to 2..200.
How to use
Connect the computer and display using wires (both + and - must go to the same computer).
Open the computer interface, paste your Lua code into the field, and press "Save".
The script is loaded, and the tick(t, dt) function is called every client tick.
Example (fully accurate and working)
function tick(t, dt) speed(1.0) trail(120) subtick(6) alpha(0.9) glow(1.2) size(1.0) local x = 0.5 + math.cos(t * 1.3) * 0.35 local y = 0.5 + math.sin(t * 1.3) * 0.35 point(x, y) color("#66CCFF") emit(x, y) local angle = t * 2.0 rotline(0.5, 0.5, 0.7, angle, 30, 1.0, 0.5, 0.2) end
How the example works
tick is called every tick, t is time in seconds (affected by speed).
point moves the main point in a circle.
emit adds a trail with the chosen color/brightness.
rotline draws a rotating line around the center.
评论 0
登录后参与评分
还没有评论,来抢沙发吧