dev.polymodloader.api.client
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
BlockEntityCanvas | 인터페이스 | Draws in the world relative to a block: (0, 0, 0) is the block's lowest corner and (1, 1, 1) its highest. |
BlockEntityPainter | 함수형 인터페이스 | Draws extra things for a mod block entity every frame, on the client (render) thread, from the client's copy of the block entity (use syncToClients for data the drawing needs). |
CameraPerspective | 열거형 | Where the camera is, as cycled with F5. |
ClientConnectionListener | 함수형 인터페이스 | Listener for ClientEvents.JOINED_WORLD and ClientEvents.LEFT_WORLD. |
ClientEvents | 클래스 | Client events; fired on the client thread, only on the client. |
ClientRegistrar | 인터페이스 | Client-only registrations. |
ClientTickListener | 함수형 인터페이스 | Listener for ClientEvents.TICK. |
ClientView | 인터페이스 | The client's state during a callback. |
DynamicTexture | 인터페이스 | A texture whose pixels the mod sets while the game runs, for example a minimap. |
FovModifier | 함수형 인터페이스 | Listener for ClientEvents.FIELD_OF_VIEW. |
HudCanvas | 인터페이스 | Drawing surface in GUI-scaled pixels; (0, 0) is the top-left corner. |
HudLayer | 함수형 인터페이스 | Draws over the in-game HUD. |
ItemTooltipListener | 함수형 인터페이스 | Listener for ClientEvents.ITEM_TOOLTIP. |
KeyBinding | 인터페이스 | A rebindable key. |
KeyCodes | 클래스 | Keyboard key codes for default key bindings (the GLFW codes the game uses). |
ModScreen | 인터페이스 | A full-screen menu made by a mod: labels, buttons, and text inputs placed in init, plus free drawing in render. |
ScreenBuilder | 인터페이스 | Places widgets on a ModScreen, in GUI-scaled pixels from the top-left corner. |
ShaderPipeline | 레코드 | A declared shader pipeline, used with WorldCanvas.quads and BlockEntityCanvas.quads. |
ShaderPipelineDefinition | 레코드 | A render pipeline with a mod's own core shader: GLSL files assets/<namespace>/shaders/<path>.vsh and .fsh in the mod's resources, for quads with a position and a colour per vertex, and a texture coordinate when the pipeline has textures. |
ShaderPipelineDefinition.Blend | 열거형 | How a pipeline's colours mix with the scene. |
ShaderPipelineDefinition.Builder | 클래스 | Builds a ShaderPipelineDefinition. |
ShaderUniform | 레코드 | One value a mod passes to its own shader pipeline, declared with ShaderPipelineDefinition.Builder.uniform. |
ShaderUniform.Source | 함수형 인터페이스 | Gives a uniform's value; called once per frame on the render thread. |
ShaderUniform.Type | 열거형 | The GLSL type of a uniform. |
TextInput | 인터페이스 | A text input placed by ScreenBuilder.textInput. |
TooltipLines | 인터페이스 | The lines of one item tooltip, first line the item's name. |
VertexSink | 인터페이스 | Takes the vertices of quads drawn with a ShaderPipeline: four per quad, in order around it. |
WorldCanvas | 인터페이스 | Draws in the world for one frame, in world coordinates, valid only during WorldPainter.paint. |
WorldPainter | 함수형 인터페이스 | Draws extra shapes in the world every frame while the client is in a world, on the render thread: area markers, paths, debug views, glowing effects. |
BlockEntityCanvas
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface BlockEntityCanvas
Draws in the world relative to a block: (0, 0, 0) is the block's lowest corner and (1, 1, 1) its highest. Valid only during BlockEntityPainter.paint.
item(ResourceId, double, double, double, float, float)
void item(ResourceId item, double x, double y, double z, float scale, float yawDegrees)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws an item as in an item frame.
| 인자 | 타입 | 설명 |
|---|---|---|
item | ResourceId | — |
x | double | — |
y | double | — |
z | double | — |
scale | float | 1 is a full block |
yawDegrees | float | turn around the vertical axis |
예외 IllegalArgumentException — for an unknown item
text(String, double, double, double, float, int)
void text(String text, double x, double y, double z, float scale, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws text centred at the position, facing the camera.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
x | double | — |
y | double | — |
z | double | — |
scale | float | a line of text is 9 × scale blocks high (0.025 makes a small label) |
argb | int | — |
animationTime()
float animationTime()
추가된 버전 0.1.0-alpha.4 또는 그 이전
World time plus the partial tick, for smooth animation.
반환 float
block(ResourceId, double, double, double, float, float)
default void block(ResourceId block, double x, double y, double z, float scale, float yawDegrees)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws the block model of block's default state, centred on x, y, z and turned yawDegrees around the vertical axis; scale 1 is full block size.
| 인자 | 타입 | 설명 |
|---|---|---|
block | ResourceId | — |
x | double | — |
y | double | — |
z | double | — |
scale | float | — |
yawDegrees | float | — |
예외 IllegalArgumentException — if block is not a block
block(BlockStateView, double, double, double, float, float)
void block(BlockStateView state, double x, double y, double z, float scale, float yawDegrees)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws the block model of state, for example a lamp that is lit, placed like block(ResourceId, double, double, double, float, float). Get a state from defaultState or WorldView.stateAt, and change it with BlockStateView.with.
| 인자 | 타입 | 설명 |
|---|---|---|
state | BlockStateView | — |
x | double | — |
y | double | — |
z | double | — |
scale | float | — |
yawDegrees | float | — |
defaultState(ResourceId)
BlockStateView defaultState(ResourceId block)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The default state of block, to change with BlockStateView.with and draw with block(BlockStateView, double, double, double, float, float).
| 인자 | 타입 | 설명 |
|---|---|---|
block | ResourceId | — |
반환 BlockStateView
예외 IllegalArgumentException — if block is not a block
quads(ShaderPipeline, Consumer<VertexSink>)
void quads(ShaderPipeline pipeline, Consumer<VertexSink> vertices)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Quads drawn with a mod shader pipeline, four vertices per quad, in the same coordinates as the other draws (the block's lowest corner is 0, 0, 0).
| 인자 | 타입 | 설명 |
|---|---|---|
pipeline | ShaderPipeline | — |
vertices | Consumer<VertexSink> | — |
BlockEntityPainter
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface BlockEntityPainter
Draws extra things for a mod block entity every frame, on the client (render) thread, from the client's copy of the block entity (use syncToClients for data the drawing needs). The block's own model is drawn by the game as usual.
paint(BlockEntityView, BlockEntityCanvas)
void paint(BlockEntityView entity, BlockEntityCanvas canvas)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws for one block entity; canvas is placed at the block's lowest corner.
| 인자 | 타입 | 설명 |
|---|---|---|
entity | BlockEntityView | — |
canvas | BlockEntityCanvas | — |
CameraPerspective
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum CameraPerspective
Where the camera is, as cycled with F5.
| 상수 | 설명 |
|---|---|
FIRST_PERSON | — |
THIRD_PERSON_BACK | — |
THIRD_PERSON_FRONT | — |
ClientConnectionListener
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ClientConnectionListener
Listener for ClientEvents.JOINED_WORLD and ClientEvents.LEFT_WORLD.
onConnection(ClientView)
void onConnection(ClientView view)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Called on the client thread when the client joins or leaves a world.
| 인자 | 타입 | 설명 |
|---|---|---|
view | ClientView | — |
ClientEvents
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class ClientEvents
Client events; fired on the client thread, only on the client.
| 상수·필드 | 타입 | 설명 |
|---|---|---|
TICK | EventKey<ClientTickListener> | The client finished a tick (20 per second, also on the title screen). |
FIELD_OF_VIEW | EventKey<FovModifier> | The field of view of the next frame, after the game's own changes (sprinting, underwater); called every frame, keep it cheap. |
JOINED_WORLD | EventKey<ClientConnectionListener> | The client joined a world (single player or a server) and has its player and world; fired once per connection. |
LEFT_WORLD | EventKey<ClientConnectionListener> | The client is leaving the world; the player and world are still available. |
ITEM_TOOLTIP | EventKey<ItemTooltipListener> | The game built an item's tooltip; listeners may add, insert, or remove lines. Not fired for items whose tooltip the game hides. Fabric API: ItemTooltipCallback; NeoForge: ItemTooltipEvent. |
ClientRegistrar
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ClientRegistrar
Client-only registrations. Obtain it in client entrypoints; on a dedicated server ModContext.client() throws.
keyBinding(String, int)
KeyBinding keyBinding(String path, int defaultKey)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Declares a key binding that players can rebind in Controls. Its name is translated from key.<mod id>.<path>; it is listed under the category key.category.<mod id>.
| 인자 | 타입 | 설명 |
|---|---|---|
path | String | binding name inside the mod's namespace |
defaultKey | int | default key, one of KeyCodes |
반환 KeyBinding
예외 IllegalStateException — after registration closed (POLY-CLIENT-002)
hudLayer(String, HudLayer)
void hudLayer(String path, HudLayer layer)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a layer drawn over the game's HUD every frame, after the game's own layers, in registration order.
| 인자 | 타입 | 설명 |
|---|---|---|
path | String | — |
layer | HudLayer | — |
예외 IllegalStateException — after registration closed (POLY-CLIENT-002)
blockEntityRenderer(ResourceId, BlockEntityPainter)
void blockEntityRenderer(ResourceId block, BlockEntityPainter painter)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws extra things for a mod block that has a block entity.
| 인자 | 타입 | 설명 |
|---|---|---|
block | ResourceId | — |
painter | BlockEntityPainter | — |
예외 IllegalArgumentException — for a block that is not one of this mod's, or a second painter
dynamicTexture(String, int, int)
DynamicTexture dynamicTexture(String path, int width, int height)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Declares a texture with pixels set by code, <mod id>:dynamic/<path>.
| 인자 | 타입 | 설명 |
|---|---|---|
path | String | — |
width | int | — |
height | int | — |
반환 DynamicTexture
worldPainter(String, WorldPainter)
void worldPainter(String path, WorldPainter painter)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws in the world every frame with painter.
| 인자 | 타입 | 설명 |
|---|---|---|
path | String | — |
painter | WorldPainter | — |
예외 IllegalArgumentException — for an invalid or used path (POLY-CLIENT-002)
shaderPipeline(String, ShaderPipelineDefinition)
ShaderPipeline shaderPipeline(String path, ShaderPipelineDefinition definition)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Declares render pipeline <mod id>:<path> using the mod's own core shader, for WorldCanvas.quads and BlockEntityCanvas.quads.
| 인자 | 타입 | 설명 |
|---|---|---|
path | String | — |
definition | ShaderPipelineDefinition | — |
반환 ShaderPipeline
예외 IllegalArgumentException — for an invalid or used path (POLY-CLIENT-002)
ClientTickListener
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ClientTickListener
Listener for ClientEvents.TICK.
onClientTick(ClientView)
void onClientTick(ClientView client)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Called at the end of each client tick.
| 인자 | 타입 | 설명 |
|---|---|---|
client | ClientView | — |
ClientView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ClientView
The client's state during a callback. Valid only during the call, on the client thread.
player()
Optional<PlayerView> player()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The local player, when in a world.
반환 Optional<PlayerView>
world()
Optional<WorldView> world()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The client's copy of the current world, when in one.
반환 Optional<WorldView>
showActionBar(String)
void showActionBar(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Shows a message above the hotbar (the action bar).
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
openScreen(ModScreen)
void openScreen(ModScreen screen)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Opens screen, replacing any open screen.
| 인자 | 타입 | 설명 |
|---|---|---|
screen | ModScreen | — |
closeScreen()
void closeScreen()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Closes the open screen, if any, returning to the game.
isScreenOpen()
boolean isScreenOpen()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether any screen (menu, inventory, chat, mod screen) is open.
반환 boolean
cameraPerspective()
CameraPerspective cameraPerspective()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The camera perspective.
반환 CameraPerspective
setCameraPerspective(CameraPerspective)
void setCameraPerspective(CameraPerspective perspective)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Changes the camera perspective, as F5 does.
| 인자 | 타입 | 설명 |
|---|---|---|
perspective | CameraPerspective | — |
setPostEffect(ResourceId)
boolean setPostEffect(ResourceId effect)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Applies a full-screen post effect from assets/<namespace>/post_effect/<path>.json, with its shaders, until cleared. The game also replaces it when the camera entity or perspective changes (as when spectating a creeper).
| 인자 | 타입 | 설명 |
|---|---|---|
effect | ResourceId | — |
반환 boolean — whether the effect loaded; failures are logged by the game
clearPostEffect()
void clearPostEffect()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Removes the post effect.
postEffect()
Optional<ResourceId> postEffect()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The active post effect, if any.
반환 Optional<ResourceId>
leaveWorld()
void leaveWorld()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Leaves the world like "Save and Quit to Title" (single player) or "Disconnect" (servers). Call it from a tick, not while drawing.
DynamicTexture
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface DynamicTexture
A texture whose pixels the mod sets while the game runs, for example a minimap. Draw it with HudCanvas.drawTexture. Use it on the client thread; changes appear after upload().
id()
ResourceId id()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The texture's ID, <mod id>:dynamic/<path>.
반환 ResourceId
width()
int width()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Width in pixels.
반환 int
height()
int height()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Height in pixels.
반환 int
setPixel(int, int, int)
void setPixel(int x, int y, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets one pixel, 0xAARRGGBB.
| 인자 | 타입 | 설명 |
|---|---|---|
x | int | — |
y | int | — |
argb | int | — |
fill(int)
void fill(int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sets every pixel.
| 인자 | 타입 | 설명 |
|---|---|---|
argb | int | — |
upload()
void upload()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Sends the pixels to the graphics card.
FovModifier
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface FovModifier
Listener for ClientEvents.FIELD_OF_VIEW.
modifyFov(float)
float modifyFov(float fov)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Returns the field of view in degrees to use instead of fov; listeners chain.
| 인자 | 타입 | 설명 |
|---|---|---|
fov | float | — |
반환 float
HudCanvas
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface HudCanvas
Drawing surface in GUI-scaled pixels; (0, 0) is the top-left corner. Colours are ARGB (0xFFFFFFFF is opaque white). Valid only during HudLayer.render(HudCanvas).
width()
int width()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Width of the screen in GUI pixels.
반환 int
height()
int height()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Height of the screen in GUI pixels.
반환 int
textWidth(String)
int textWidth(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Width of text in the game font.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
반환 int
drawText(String, int, int, int)
void drawText(String text, int x, int y, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws text with a shadow.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
x | int | — |
y | int | — |
argb | int | — |
fill(int, int, int, int, int)
void fill(int x1, int y1, int x2, int y2, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Fills the rectangle from (x1, y1) inclusive to (x2, y2) exclusive.
| 인자 | 타입 | 설명 |
|---|---|---|
x1 | int | — |
y1 | int | — |
x2 | int | — |
y2 | int | — |
argb | int | — |
drawTexture(ResourceId, int, int, int, int)
void drawTexture(ResourceId texture, int x, int y, int width, int height)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws a whole texture, such as my_mod:textures/gui/icon.png or a DynamicTexture, stretched to width × height.
| 인자 | 타입 | 설명 |
|---|---|---|
texture | ResourceId | — |
x | int | — |
y | int | — |
width | int | — |
height | int | — |
HudLayer
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface HudLayer
Draws over the in-game HUD. Called every frame on the client (render) thread while in a world.
render(HudCanvas)
void render(HudCanvas canvas)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws the layer. Keep it fast: it runs every frame. Exceptions are logged once (POLY-CLIENT-003) and the layer is disabled.
| 인자 | 타입 | 설명 |
|---|---|---|
canvas | HudCanvas | — |
ItemTooltipListener
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ItemTooltipListener
Listener for ClientEvents.ITEM_TOOLTIP.
onItemTooltip(ItemStackRef, TooltipLines, boolean)
void onItemTooltip(ItemStackRef stack, TooltipLines lines, boolean advanced)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Called on the client thread whenever the game builds an item's tooltip (every frame the tooltip is shown, and for the creative search), after the game's own lines. Keep it cheap.
| 인자 | 타입 | 설명 |
|---|---|---|
stack | ItemStackRef | the item stack; read it, do not change it (it is the client's copy) |
lines | TooltipLines | the tooltip lines to read and change |
advanced | boolean | whether advanced tooltips are on (F3+H) |
KeyBinding
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface KeyBinding
A rebindable key. Query it on the client thread, for example from ClientEvents.TICK.
id()
ResourceId id()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The binding's ID.
반환 ResourceId
isDown()
boolean isDown()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the key is held now.
반환 boolean
consumeClick()
boolean consumeClick()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Returns true once per press since the last call, so no press is lost between ticks.
반환 boolean
KeyCodes
클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public final class KeyCodes
Keyboard key codes for default key bindings (the GLFW codes the game uses).
| 상수·필드 | 타입 | 설명 |
|---|---|---|
UNBOUND | int | No default key; the player must bind one. |
A | int | — |
B | int | — |
G | int | — |
H | int | — |
J | int | — |
K | int | — |
L | int | — |
M | int | — |
N | int | — |
O | int | — |
P | int | — |
R | int | — |
U | int | — |
V | int | — |
X | int | — |
Y | int | — |
Z | int | — |
F6 | int | — |
F7 | int | — |
F8 | int | — |
F9 | int | — |
F10 | int | — |
ModScreen
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ModScreen
A full-screen menu made by a mod: labels, buttons, and text inputs placed in init, plus free drawing in render. Open it with ClientView.openScreen(ModScreen). All methods run on the client (render) thread.
title()
String title()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Title used for narration and the window title.
반환 String
init(ScreenBuilder)
void init(ScreenBuilder screen)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Places widgets. Called when the screen opens and again when the window is resized, with a fresh builder each time.
| 인자 | 타입 | 설명 |
|---|---|---|
screen | ScreenBuilder | — |
render(HudCanvas)
default void render(HudCanvas canvas)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws extra content every frame, above the background and below the widgets.
| 인자 | 타입 | 설명 |
|---|---|---|
canvas | HudCanvas | — |
pausesGame()
default boolean pausesGame()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the game pauses while the screen is open (single player only).
반환 boolean
onClosed()
default void onClosed()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The screen was closed, by the player (Esc) or by code.
ScreenBuilder
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface ScreenBuilder
Places widgets on a ModScreen, in GUI-scaled pixels from the top-left corner.
width()
int width()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Screen width.
반환 int
height()
int height()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Screen height.
반환 int
textWidth(String)
int textWidth(String text)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Width of text in the game font.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
반환 int
label(String, int, int, int)
void label(String text, int x, int y, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Text drawn every frame.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
x | int | — |
y | int | — |
argb | int | — |
button(String, int, int, int, int, Runnable)
void button(String label, int x, int y, int width, int height, Runnable onPress)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A clickable button; onPress runs on the client thread.
| 인자 | 타입 | 설명 |
|---|---|---|
label | String | — |
x | int | — |
y | int | — |
width | int | — |
height | int | — |
onPress | Runnable | — |
textInput(int, int, int, String)
TextInput textInput(int x, int y, int width, String initialValue)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A single-line text input, 20 pixels high.
| 인자 | 타입 | 설명 |
|---|---|---|
x | int | — |
y | int | — |
width | int | — |
initialValue | String | — |
반환 TextInput
close()
void close()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Closes this screen.
ShaderPipeline
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ShaderPipeline(ResourceId id)
A declared shader pipeline, used with WorldCanvas.quads and BlockEntityCanvas.quads.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
id | ResourceId | the pipeline's ID, <mod id>:<path> |
ShaderPipelineDefinition
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ShaderPipelineDefinition(ResourceId shader, ShaderPipelineDefinition.Blend blend, boolean cull, boolean depthTest, boolean depthWrite, List<ResourceId> textures, List<ShaderUniform> uniforms)
A render pipeline with a mod's own core shader: GLSL files assets/<namespace>/shaders/<path>.vsh and .fsh in the mod's resources, for quads with a position and a colour per vertex, and a texture coordinate when the pipeline has textures.
The vertex shader receives in vec3 Position and in vec4 Color, plus in vec2 UV0 when the pipeline has textures. Use the game's uniform blocks for the transforms and time, as the game's core/position_color shader does: #moj_import <minecraft:dynamictransforms.glsl> and <minecraft:projection.glsl> for ModelViewMat, ProjMat and ColorModulator, and <minecraft:globals.glsl> for GameTime.
Textures are bound in order as uniform sampler2D Sampler0, Sampler1, and so on. Each is a texture file such as my_mod:textures/effect/noise.png or a DynamicTexture; a missing file shows the game's missing-texture pattern. The mod's own values are the uniform block ModUniforms (see ShaderUniform).
A shader that fails to compile is reported in the log (POLY-CLIENT-006), and its quads are skipped.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
shader | ResourceId | the shader files' location without extension, for example my_mod:core/glow |
blend | ShaderPipelineDefinition.Blend | how the quads mix with what is behind them |
cull | boolean | whether quads facing away from the camera are skipped |
depthTest | boolean | whether blocks in front hide the quads |
depthWrite | boolean | whether the quads hide what is drawn behind them later |
textures | List<ResourceId> | the textures bound as Sampler0 onwards, at most MAX_TEXTURES |
uniforms | List<ShaderUniform> | the fields of ModUniforms in order, at most MAX_UNIFORMS, with unique names |
| 상수·필드 | 타입 | 설명 |
|---|---|---|
MAX_TEXTURES | int | The most textures one pipeline binds. |
MAX_UNIFORMS | int | The most fields in one pipeline's ModUniforms block. |
ShaderPipelineDefinition(ResourceId, ShaderPipelineDefinition.Blend, boolean, boolean, boolean, List<ResourceId>, List<ShaderUniform>)
public ShaderPipelineDefinition(ResourceId shader, ShaderPipelineDefinition.Blend blend, boolean cull, boolean depthTest, boolean depthWrite, List<ResourceId> textures, List<ShaderUniform> uniforms)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Validates the definition.
| 인자 | 타입 | 설명 |
|---|---|---|
shader | ResourceId | — |
blend | ShaderPipelineDefinition.Blend | — |
cull | boolean | — |
depthTest | boolean | — |
depthWrite | boolean | — |
textures | List<ResourceId> | — |
uniforms | List<ShaderUniform> | — |
예외 IllegalArgumentException — with POLY-CLIENT-002 for too many textures or uniforms, or two uniforms with the same name
ShaderPipelineDefinition(ResourceId, ShaderPipelineDefinition.Blend, boolean, boolean, boolean)
public ShaderPipelineDefinition(ResourceId shader, ShaderPipelineDefinition.Blend blend, boolean cull, boolean depthTest, boolean depthWrite)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A pipeline without textures or mod uniforms.
| 인자 | 타입 | 설명 |
|---|---|---|
shader | ResourceId | — |
blend | ShaderPipelineDefinition.Blend | — |
cull | boolean | — |
depthTest | boolean | — |
depthWrite | boolean | — |
textured()
public boolean textured()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the vertices carry texture coordinates (UV0).
반환 boolean
builder(ResourceId)
public static ShaderPipelineDefinition.Builder builder(ResourceId shader)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A translucent, double-sided pipeline that blocks hide and that hides nothing.
| 인자 | 타입 | 설명 |
|---|---|---|
shader | ResourceId | — |
반환 ShaderPipelineDefinition.Builder
ShaderPipelineDefinition.Blend
열거형 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static enum Blend
How a pipeline's colours mix with the scene.
| 상수 | 설명 |
|---|---|
OPAQUE | Replaces what is behind; alpha is ignored. |
TRANSLUCENT | Mixes by alpha, like stained glass. |
ADDITIVE | Adds light, for glows. |
ShaderPipelineDefinition.Builder
클래스 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static final class Builder
Builds a ShaderPipelineDefinition.
blend(ShaderPipelineDefinition.Blend)
public ShaderPipelineDefinition.Builder blend(ShaderPipelineDefinition.Blend blend)
추가된 버전 0.1.0-alpha.4 또는 그 이전
How colours mix; Blend.TRANSLUCENT by default.
| 인자 | 타입 | 설명 |
|---|---|---|
blend | ShaderPipelineDefinition.Blend | — |
반환 ShaderPipelineDefinition.Builder
cull()
public ShaderPipelineDefinition.Builder cull()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Skips quads facing away from the camera.
반환 ShaderPipelineDefinition.Builder
noDepthTest()
public ShaderPipelineDefinition.Builder noDepthTest()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws the quads in front of blocks.
반환 ShaderPipelineDefinition.Builder
depthWrite()
public ShaderPipelineDefinition.Builder depthWrite()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The quads hide what is drawn behind them later, like solid geometry.
반환 ShaderPipelineDefinition.Builder
texture(ResourceId)
public ShaderPipelineDefinition.Builder texture(ResourceId texture)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Binds a texture as the next sampler: the first call is Sampler0. Its vertices then need texture coordinates (VertexSink.vertex(double, double, double, float, float, int)).
| 인자 | 타입 | 설명 |
|---|---|---|
texture | ResourceId | a texture file, for example my_mod:textures/effect/noise.png, or a DynamicTexture.id() |
반환 ShaderPipelineDefinition.Builder
uniform(String, ShaderUniform.Type, ShaderUniform.Source)
public ShaderPipelineDefinition.Builder uniform(String name, ShaderUniform.Type type, ShaderUniform.Source source)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a field to the pipeline's ModUniforms block, after the ones added before.
| 인자 | 타입 | 설명 |
|---|---|---|
name | String | — |
type | ShaderUniform.Type | — |
source | ShaderUniform.Source | — |
반환 ShaderPipelineDefinition.Builder
예외 IllegalArgumentException — for an invalid name (POLY-CLIENT-002)
build()
public ShaderPipelineDefinition build()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Creates the definition.
반환 ShaderPipelineDefinition
예외 IllegalArgumentException — for too many textures or uniforms, or a repeated uniform name (POLY-CLIENT-002)
ShaderUniform
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record ShaderUniform(String name, ShaderUniform.Type type, ShaderUniform.Source source)
One value a mod passes to its own shader pipeline, declared with ShaderPipelineDefinition.Builder.uniform. A pipeline's values form the uniform block ModUniforms, in declaration order:
layout(std140) uniform ModUniforms {
float Strength;
vec4 Tint;
};
Poly Mod Loader asks Source.values() once per frame on the render thread, before the world is drawn, and uploads the result. A source that throws or returns the wrong number of values is reported once (POLY-CLIENT-007); the pipeline then keeps its last good values, which start as zeros.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
name | String | the field name in GLSL: letters, digits and _, not starting with a digit or gl_ |
type | ShaderUniform.Type | the GLSL type |
source | ShaderUniform.Source | gives the value each frame |
ShaderUniform.Source
함수형 인터페이스 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static interface Source
Gives a uniform's value; called once per frame on the render thread.
values()
float[] values()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The value: exactly Type.components() floats.
반환 float[]
ShaderUniform.Type
열거형 · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public static enum Type
The GLSL type of a uniform.
| 상수 | 설명 |
|---|---|
FLOAT | float. |
VEC2 | vec2. |
VEC3 | vec3. |
VEC4 | vec4. |
components()
public int components()
추가된 버전 0.1.0-alpha.4 또는 그 이전
How many floats Source.values() must return.
반환 int
TextInput
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface TextInput
A text input placed by ScreenBuilder.textInput.
value()
String value()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The current text.
반환 String
setValue(String)
void setValue(String value)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Replaces the text.
| 인자 | 타입 | 설명 |
|---|---|---|
value | String | — |
TooltipLines
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface TooltipLines
The lines of one item tooltip, first line the item's name. Lines are plain text; section-sign formatting codes (for example "§7" for grey) are drawn as colours. Lines the game or other mods added keep their formatting unless they are removed. Valid only during the listener call.
size()
int size()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Number of lines, the name included.
반환 int
get(int)
String get(int index)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The text of line index without formatting.
| 인자 | 타입 | 설명 |
|---|---|---|
index | int | — |
반환 String
예외 IndexOutOfBoundsException — for an index outside [0, size())
add(String)
void add(String line)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a line at the end.
| 인자 | 타입 | 설명 |
|---|---|---|
line | String | — |
add(int, String)
void add(int index, String line)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Inserts a line before line index; size() appends.
| 인자 | 타입 | 설명 |
|---|---|---|
index | int | — |
line | String | — |
예외 IndexOutOfBoundsException — for an index outside [0, size()]
remove(int)
void remove(int index)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Removes line index.
| 인자 | 타입 | 설명 |
|---|---|---|
index | int | — |
예외 IndexOutOfBoundsException — for an index outside [0, size())
VertexSink
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface VertexSink
Takes the vertices of quads drawn with a ShaderPipeline: four per quad, in order around it.
vertex(double, double, double, float, float, int)
VertexSink vertex(double x, double y, double z, float u, float v, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a vertex with a texture coordinate and a colour 0xAARRGGBB; the shader receives them as Position, UV0 and Color. The coordinate is used only by pipelines with textures; (0, 0) is the texture's top left corner and (1, 1) its bottom right.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
u | float | — |
v | float | — |
argb | int | — |
반환 VertexSink
vertex(double, double, double, int)
default VertexSink vertex(double x, double y, double z, int argb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Adds a vertex with a colour 0xAARRGGBB and texture coordinate (0, 0).
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
argb | int | — |
반환 VertexSink
WorldCanvas
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface WorldCanvas
Draws in the world for one frame, in world coordinates, valid only during WorldPainter.paint. Lines, boxes, points and text are hidden behind blocks unless drawn through onTop(). Colours are 0xAARRGGBB; an alpha of 0 draws nothing.
cameraX()
double cameraX()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Camera x this frame.
반환 double
cameraY()
double cameraY()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Camera y this frame.
반환 double
cameraZ()
double cameraZ()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Camera z this frame.
반환 double
animationTime()
float animationTime()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Game time in ticks plus the partial tick, for smooth animation.
반환 float
line(double, double, double, double, double, double, int, float)
void line(double x1, double y1, double z1, double x2, double y2, double z2, int argb, float width)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A line from one point to another, width pixels wide.
| 인자 | 타입 | 설명 |
|---|---|---|
x1 | double | — |
y1 | double | — |
z1 | double | — |
x2 | double | — |
y2 | double | — |
z2 | double | — |
argb | int | — |
width | float | — |
box(double, double, double, double, double, double, int, float, int)
void box(double minX, double minY, double minZ, double maxX, double maxY, double maxZ, int strokeArgb, float width, int fillArgb)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A box between two corners: its edges in strokeArgb (width pixels wide) and its faces filled with fillArgb; pass 0 for either to leave it out.
| 인자 | 타입 | 설명 |
|---|---|---|
minX | double | — |
minY | double | — |
minZ | double | — |
maxX | double | — |
maxY | double | — |
maxZ | double | — |
strokeArgb | int | — |
width | float | — |
fillArgb | int | — |
blockOutline(BlockPos, int, float)
default void blockOutline(BlockPos pos, int argb, float width)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The edges of one block.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
argb | int | — |
width | float | — |
point(double, double, double, int, float)
void point(double x, double y, double z, int argb, float size)
추가된 버전 0.1.0-alpha.4 또는 그 이전
A square dot size pixels wide.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
argb | int | — |
size | float | — |
text(String, double, double, double, int, float)
void text(String text, double x, double y, double z, int argb, float scale)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Text facing the camera, centred on the point; scale 1 is the game's label size.
| 인자 | 타입 | 설명 |
|---|---|---|
text | String | — |
x | double | — |
y | double | — |
z | double | — |
argb | int | — |
scale | float | — |
quads(ShaderPipeline, Consumer<VertexSink>)
void quads(ShaderPipeline pipeline, Consumer<VertexSink> vertices)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Quads drawn with a mod shader pipeline: four vertices per quad, in world coordinates. Unlike the other shapes, these follow the pipeline's depth settings.
| 인자 | 타입 | 설명 |
|---|---|---|
pipeline | ShaderPipeline | — |
vertices | Consumer<VertexSink> | — |
onTop()
WorldCanvas onTop()
추가된 버전 0.1.0-alpha.4 또는 그 이전
This canvas, drawing lines, boxes, points and text in front of blocks.
반환 WorldCanvas
WorldPainter
함수형 인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface WorldPainter
Draws extra shapes in the world every frame while the client is in a world, on the render thread: area markers, paths, debug views, glowing effects. Keep it fast; it runs every frame.
paint(WorldCanvas)
void paint(WorldCanvas canvas)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Draws this frame's shapes on canvas.
| 인자 | 타입 | 설명 |
|---|---|---|
canvas | WorldCanvas | — |