본문으로 건너뛰기
버전: Minecraft 26.2

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.

인자타입설명
itemResourceId—
xdouble—
ydouble—
zdouble—
scalefloat1 is a full block
yawDegreesfloatturn 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.

인자타입설명
textString—
xdouble—
ydouble—
zdouble—
scalefloata line of text is 9 × scale blocks high (0.025 makes a small label)
argbint—

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.

인자타입설명
blockResourceId—
xdouble—
ydouble—
zdouble—
scalefloat—
yawDegreesfloat—

예외 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.

인자타입설명
stateBlockStateView—
xdouble—
ydouble—
zdouble—
scalefloat—
yawDegreesfloat—

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).

인자타입설명
blockResourceId—

반환 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).

인자타입설명
pipelineShaderPipeline—
verticesConsumer<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.

인자타입설명
entityBlockEntityView—
canvasBlockEntityCanvas—

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.

인자타입설명
viewClientView—

ClientEvents​

클래스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public final class ClientEvents

Client events; fired on the client thread, only on the client.

상수·필드타입설명
TICKEventKey<ClientTickListener>The client finished a tick (20 per second, also on the title screen).
FIELD_OF_VIEWEventKey<FovModifier>The field of view of the next frame, after the game's own changes (sprinting, underwater); called every frame, keep it cheap.
JOINED_WORLDEventKey<ClientConnectionListener>The client joined a world (single player or a server) and has its player and world; fired once per connection.
LEFT_WORLDEventKey<ClientConnectionListener>The client is leaving the world; the player and world are still available.
ITEM_TOOLTIPEventKey<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>.

인자타입설명
pathStringbinding name inside the mod's namespace
defaultKeyintdefault 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.

인자타입설명
pathString—
layerHudLayer—

예외 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.

인자타입설명
blockResourceId—
painterBlockEntityPainter—

예외 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>.

인자타입설명
pathString—
widthint—
heightint—

반환 DynamicTexture

worldPainter(String, WorldPainter)​

void worldPainter(String path, WorldPainter painter)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Draws in the world every frame with painter.

인자타입설명
pathString—
painterWorldPainter—

예외 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.

인자타입설명
pathString—
definitionShaderPipelineDefinition—

반환 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.

인자타입설명
clientClientView—

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).

인자타입설명
textString—

openScreen(ModScreen)​

void openScreen(ModScreen screen)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Opens screen, replacing any open screen.

인자타입설명
screenModScreen—

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.

인자타입설명
perspectiveCameraPerspective—

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).

인자타입설명
effectResourceId—

반환 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.

인자타입설명
xint—
yint—
argbint—

fill(int)​

void fill(int argb)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Sets every pixel.

인자타입설명
argbint—

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.

인자타입설명
fovfloat—

반환 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.

인자타입설명
textString—

반환 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.

인자타입설명
textString—
xint—
yint—
argbint—

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.

인자타입설명
x1int—
y1int—
x2int—
y2int—
argbint—

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.

인자타입설명
textureResourceId—
xint—
yint—
widthint—
heightint—

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.

인자타입설명
canvasHudCanvas—

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.

인자타입설명
stackItemStackRefthe item stack; read it, do not change it (it is the client's copy)
linesTooltipLinesthe tooltip lines to read and change
advancedbooleanwhether 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).

상수·필드타입설명
UNBOUNDintNo default key; the player must bind one.
Aint—
Bint—
Gint—
Hint—
Jint—
Kint—
Lint—
Mint—
Nint—
Oint—
Pint—
Rint—
Uint—
Vint—
Xint—
Yint—
Zint—
F6int—
F7int—
F8int—
F9int—
F10int—

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.

인자타입설명
screenScreenBuilder—

render(HudCanvas)​

default void render(HudCanvas canvas)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Draws extra content every frame, above the background and below the widgets.

인자타입설명
canvasHudCanvas—

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.

인자타입설명
textString—

반환 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.

인자타입설명
textString—
xint—
yint—
argbint—

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.

인자타입설명
labelString—
xint—
yint—
widthint—
heightint—
onPressRunnable—

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.

인자타입설명
xint—
yint—
widthint—
initialValueString—

반환 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.

구성 요소타입설명
idResourceIdthe 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.

구성 요소타입설명
shaderResourceIdthe shader files' location without extension, for example my_mod:core/glow
blendShaderPipelineDefinition.Blendhow the quads mix with what is behind them
cullbooleanwhether quads facing away from the camera are skipped
depthTestbooleanwhether blocks in front hide the quads
depthWritebooleanwhether the quads hide what is drawn behind them later
texturesList<ResourceId>the textures bound as Sampler0 onwards, at most MAX_TEXTURES
uniformsList<ShaderUniform>the fields of ModUniforms in order, at most MAX_UNIFORMS, with unique names
상수·필드타입설명
MAX_TEXTURESintThe most textures one pipeline binds.
MAX_UNIFORMSintThe 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.

인자타입설명
shaderResourceId—
blendShaderPipelineDefinition.Blend—
cullboolean—
depthTestboolean—
depthWriteboolean—
texturesList<ResourceId>—
uniformsList<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.

인자타입설명
shaderResourceId—
blendShaderPipelineDefinition.Blend—
cullboolean—
depthTestboolean—
depthWriteboolean—

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.

인자타입설명
shaderResourceId—

반환 ShaderPipelineDefinition.Builder

ShaderPipelineDefinition.Blend​

열거형 · 추가된 버전 0.1.0-alpha.4 또는 그 이전

public static enum Blend

How a pipeline's colours mix with the scene.

상수설명
OPAQUEReplaces what is behind; alpha is ignored.
TRANSLUCENTMixes by alpha, like stained glass.
ADDITIVEAdds 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.

인자타입설명
blendShaderPipelineDefinition.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)).

인자타입설명
textureResourceIda 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.

인자타입설명
nameString—
typeShaderUniform.Type—
sourceShaderUniform.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.

구성 요소타입설명
nameStringthe field name in GLSL: letters, digits and _, not starting with a digit or gl_
typeShaderUniform.Typethe GLSL type
sourceShaderUniform.Sourcegives 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.

상수설명
FLOATfloat.
VEC2vec2.
VEC3vec3.
VEC4vec4.

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.

인자타입설명
valueString—

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.

인자타입설명
indexint—

반환 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.

인자타입설명
lineString—

add(int, String)​

void add(int index, String line)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Inserts a line before line index; size() appends.

인자타입설명
indexint—
lineString—

예외 IndexOutOfBoundsException — for an index outside [0, size()]

remove(int)​

void remove(int index)

추가된 버전 0.1.0-alpha.4 또는 그 이전

Removes line index.

인자타입설명
indexint—

예외 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.

인자타입설명
xdouble—
ydouble—
zdouble—
ufloat—
vfloat—
argbint—

반환 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).

인자타입설명
xdouble—
ydouble—
zdouble—
argbint—

반환 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.

인자타입설명
x1double—
y1double—
z1double—
x2double—
y2double—
z2double—
argbint—
widthfloat—

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.

인자타입설명
minXdouble—
minYdouble—
minZdouble—
maxXdouble—
maxYdouble—
maxZdouble—
strokeArgbint—
widthfloat—
fillArgbint—

blockOutline(BlockPos, int, float)​

default void blockOutline(BlockPos pos, int argb, float width)

추가된 버전 0.1.0-alpha.4 또는 그 이전

The edges of one block.

인자타입설명
posBlockPos—
argbint—
widthfloat—

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.

인자타입설명
xdouble—
ydouble—
zdouble—
argbint—
sizefloat—

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.

인자타입설명
textString—
xdouble—
ydouble—
zdouble—
argbint—
scalefloat—

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.

인자타입설명
pipelineShaderPipeline—
verticesConsumer<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.

인자타입설명
canvasWorldCanvas—
Buy me a coffee