dev.polymodloader.api.world
이 페이지는 소스의 Javadoc에서 ./gradlew apiReference로 만든 것입니다. 설명은 코드에 적힌 영어 그대로입니다. 직접 고치지 말고 소스의 주석을 고친 뒤 다시 만드세요.
| 형식 | 종류 | 설명 |
|---|---|---|
BlockPos | 레코드 | Integer block coordinates. |
Direction | 열거형 | The six block faces; the first four horizontal ones are NORTH to EAST. |
InteractionResult | 열거형 | Outcome of a block or item interaction, mapped onto the game's interaction results. |
StorageOptions | 레코드 | How WorldView.storage(ResourceId, StorageOptions) keeps data. |
StoredData | 인터페이스 | Mod data saved with one dimension of a world, for state that belongs to no block or entity (counters, quest progress, claimed areas). |
Vector3 | 레코드 | A direction or velocity in blocks (per tick for velocities). |
WorldView | 인터페이스 | Read and write access to one loaded dimension. |
BlockPos
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record BlockPos(int x, int y, int z)
Integer block coordinates. Inside a game test the coordinates are relative to the test structure; everywhere else they are absolute world coordinates.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
x | int | east (+) / west (-) |
y | int | up (+) / down (-) |
z | int | south (+) / north (-) |
| 상수·필드 | 타입 | 설명 |
|---|---|---|
ORIGIN | BlockPos | The position (0, 0, 0). |
of(int, int, int)
public static BlockPos of(int x, int y, int z)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Creates a position.
| 인자 | 타입 | 설명 |
|---|---|---|
x | int | — |
y | int | — |
z | int | — |
반환 BlockPos
offset(int, int, int)
public BlockPos offset(int dx, int dy, int dz)
추가된 버전 0.1.0-alpha.4 또는 그 이전
This position moved by the given amounts.
| 인자 | 타입 | 설명 |
|---|---|---|
dx | int | — |
dy | int | — |
dz | int | — |
반환 BlockPos
above()
public BlockPos above()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The position one block up.
반환 BlockPos
below()
public BlockPos below()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The position one block down.
반환 BlockPos
Direction
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum Direction
The six block faces; the first four horizontal ones are NORTH to EAST.
| 상수 | 설명 |
|---|---|
DOWN | — |
UP | — |
NORTH | — |
SOUTH | — |
WEST | — |
EAST | — |
isHorizontal()
public boolean isHorizontal()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether this is one of the four horizontal directions.
반환 boolean
opposite()
public Direction opposite()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The direction pointing the other way.
반환 Direction
InteractionResult
열거형 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public enum InteractionResult
Outcome of a block or item interaction, mapped onto the game's interaction results.
| 상수 | 설명 |
|---|---|
SUCCESS | The interaction happened; the player's arm swings. |
CONSUME | The interaction happened without an arm swing. |
PASS | Nothing happened; the game continues with its default behaviour. |
FAIL | The interaction was refused; the game does not try anything else. |
StorageOptions
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record StorageOptions(int version, Optional<DataMigration> migration, boolean syncToClients)
How WorldView.storage(ResourceId, StorageOptions) keeps data.
| 구성 요소 | 타입 | 설명 |
|---|---|---|
version | int | the current data version; saved data of an older version runs migration |
migration | Optional<DataMigration> | upgrades older data, if any |
syncToClients | boolean | whether every player's client gets a read-only copy, updated on StoredData.markChanged() |
| 상수·필드 | 타입 | 설명 |
|---|---|---|
DEFAULT | StorageOptions | Version 0, no migration, not synchronised. |
withVersion(int, DataMigration)
public StorageOptions withVersion(int value, DataMigration upgrade)
추가된 버전 0.1.0-alpha.4 또는 그 이전
These options at version, upgrading older data with migration.
| 인자 | 타입 | 설명 |
|---|---|---|
value | int | — |
upgrade | DataMigration | — |
반환 StorageOptions
syncedToClients()
public StorageOptions syncedToClients()
추가된 버전 0.1.0-alpha.4 또는 그 이전
These options, synchronised to clients.
반환 StorageOptions
StoredData
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface StoredData
Mod data saved with one dimension of a world, for state that belongs to no block or entity (counters, quest progress, claimed areas). Server side only.
data()
DataTree data()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The data; call markChanged() after changing it so it is saved.
반환 DataTree
markChanged()
void markChanged()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Marks the data for saving with the next world save.
Vector3
레코드 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public record Vector3(double x, double y, double z)
A direction or velocity in blocks (per tick for velocities).
| 구성 요소 | 타입 | 설명 |
|---|---|---|
x | double | east (+) / west (-) |
y | double | up (+) / down (-) |
z | double | south (+) / north (-) |
| 상수·필드 | 타입 | 설명 |
|---|---|---|
ZERO | Vector3 | No movement. |
length()
public double length()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Length of the vector.
반환 double
WorldView
인터페이스 · 안정성 PREVIEW · 추가된 버전 0.1.0-alpha.4 또는 그 이전
public interface WorldView
Read and write access to one loaded dimension.
Thread: only on the thread that handed out the view (the server or client thread). Lifetime: views passed to callbacks are valid only during the callback; do not store them.
dimension()
ResourceId dimension()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The dimension, for example minecraft:overworld.
반환 ResourceId
isClientSide()
boolean isClientSide()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether this is the client's copy of the world, which must not be changed.
반환 boolean
blockAt(BlockPos)
ResourceId blockAt(BlockPos pos)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The block at pos, for example minecraft:air. Unloaded positions read as air.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
반환 ResourceId
setBlock(BlockPos, ResourceId)
boolean setBlock(BlockPos pos, ResourceId block)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Replaces the block at pos with the default state of block and notifies neighbours and clients.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
block | ResourceId | — |
반환 boolean — whether the block changed
예외 IllegalArgumentException — when block is not a registered block
예외 IllegalStateException — on the client side
gameTime()
long gameTime()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Ticks since the world was created.
반환 long
players()
List<PlayerView> players()
추가된 버전 0.1.0-alpha.4 또는 그 이전
Players in this dimension.
반환 List<PlayerView>
stateAt(BlockPos)
BlockStateView stateAt(BlockPos pos)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The block and its property values at pos.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
반환 BlockStateView
setProperty(BlockPos, BlockProperty<T>, T)
<T> boolean setProperty(BlockPos pos, BlockProperty<T> property, T value)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Changes one property of the block at pos, keeping the others.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
property | BlockProperty<T> | — |
value | T | — |
반환 boolean — whether the state changed
예외 IllegalArgumentException — when the block has no such property or the value is not allowed
예외 IllegalStateException — on the client side
blockEntityAt(BlockPos)
Optional<BlockEntityView> blockEntityAt(BlockPos pos)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The mod block entity at pos, if there is one.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
반환 Optional<BlockEntityView>
storage(ResourceId)
StoredData storage(ResourceId id)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Data saved with this dimension under id (use your mod ID as namespace), created empty on first use.
| 인자 | 타입 | 설명 |
|---|---|---|
id | ResourceId | — |
반환 StoredData
예외 IllegalStateException — on the client side
schedule(int, Runnable)
void schedule(int ticks, Runnable task)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Runs task on the server thread after ticks ticks of this dimension (0 = next tick). Pending tasks are dropped when the server stops; they are not saved.
| 인자 | 타입 | 설명 |
|---|---|---|
ticks | int | — |
task | Runnable | — |
예외 IllegalStateException — on the client side
storage(ResourceId, StorageOptions)
StoredData storage(ResourceId id, StorageOptions options)
추가된 버전 0.1.0-alpha.4 또는 그 이전
World storage with a data version and optional client synchronisation. Saved data records its version; loading older data runs the migration first. The key poly_version is reserved. On the client this returns the synchronised copy (empty until the server sends it), read-only.
| 인자 | 타입 | 설명 |
|---|---|---|
id | ResourceId | — |
options | StorageOptions | — |
반환 StoredData
spawnEntity(ResourceId, double, double, double)
EntityView spawnEntity(ResourceId type, double x, double y, double z)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Spawns an entity of type (for example minecraft:pig or a mod mob) at the position; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
type | ResourceId | — |
x | double | — |
y | double | — |
z | double | — |
반환 EntityView
예외 IllegalArgumentException — for an unknown or unspawnable type
entitiesNear(double, double, double, double)
List<EntityView> entitiesNear(double x, double y, double z, double radius)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Entities whose position is within radius blocks of the point.
| 인자 | 타입 | 설명 |
|---|---|---|
x | double | — |
y | double | — |
z | double | — |
radius | double | — |
반환 List<EntityView>
playSound(BlockPos, ResourceId, float, float)
void playSound(BlockPos pos, ResourceId sound, float volume, float pitch)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Plays a sound to players near pos (server) or locally (client).
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
sound | ResourceId | — |
volume | float | — |
pitch | float | — |
예외 IllegalArgumentException — for an unknown sound event
spawnParticles(ResourceId, double, double, double, int, double)
void spawnParticles(ResourceId particle, double x, double y, double z, int count, double spread)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Shows a simple particle (one without options, such as minecraft:heart or minecraft:flame) to nearby players; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
particle | ResourceId | — |
x | double | — |
y | double | — |
z | double | — |
count | int | — |
spread | double | random offset in blocks on each axis |
예외 IllegalArgumentException — for an unknown particle or one that needs options
gameRule(GameRuleKey<T>)
<T> T gameRule(GameRuleKey<T> rule)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The current value of a game rule in this world; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
rule | GameRuleKey<T> | — |
반환 T
setGameRule(GameRuleKey<T>, T)
<T> void setGameRule(GameRuleKey<T> rule, T value)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Changes a game rule for this world; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
rule | GameRuleKey<T> | — |
value | T | — |
setChunkForced(int, int, boolean)
boolean setChunkForced(int chunkX, int chunkZ, boolean forced)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Keeps a chunk loaded (and ticking) until released, like /forceload; saved with the world. Chunk coordinates are block coordinates divided by 16 (rounded down).
| 인자 | 타입 | 설명 |
|---|---|---|
chunkX | int | — |
chunkZ | int | — |
forced | boolean | — |
반환 boolean — whether the setting changed
예외 IllegalStateException — on the client side
isChunkLoaded(int, int)
boolean isChunkLoaded(int chunkX, int chunkZ)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the chunk is loaded.
| 인자 | 타입 | 설명 |
|---|---|---|
chunkX | int | — |
chunkZ | int | — |
반환 boolean
biomeAt(BlockPos)
ResourceId biomeAt(BlockPos pos)
추가된 버전 0.1.0-alpha.4 또는 그 이전
The biome at pos, for example minecraft:plains.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
반환 ResourceId
tags()
TagView tags()
추가된 버전 0.1.0-alpha.4 또는 그 이전
The block, item, and entity type tags the game loaded (the server's data, or the client's copy).
반환 TagView
isBlockIn(BlockPos, TagKey)
boolean isBlockIn(BlockPos pos, TagKey tag)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Whether the block at pos is in a block tag, for example #minecraft:logs. Unloaded positions read as air.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
tag | TagKey | — |
반환 boolean
예외 IllegalArgumentException — when tag is not a block tag
emittedLight(BlockPos)
int emittedLight(BlockPos pos)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Light the block at pos emits, 0–15.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
반환 int
naturalSpawns(BlockPos, MobCategory)
List<ResourceId> naturalSpawns(BlockPos pos, MobCategory category)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Mobs that can spawn by themselves at pos in category, by the biome there; for checking natural spawn settings.
| 인자 | 타입 | 설명 |
|---|---|---|
pos | BlockPos | — |
category | MobCategory | — |
반환 List<ResourceId>
otherDimension(ResourceId)
Optional<WorldView> otherDimension(ResourceId dimension)
추가된 버전 0.1.0-alpha.4 또는 그 이전
Another loaded dimension of the same server, such as a mod dimension from data; server side only.
| 인자 | 타입 | 설명 |
|---|---|---|
dimension | ResourceId | — |
반환 Optional<WorldView>