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

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.

구성 요소타입설명
xinteast (+) / west (-)
yintup (+) / down (-)
zintsouth (+) / north (-)
상수·필드타입설명
ORIGINBlockPosThe 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.

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

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

인자타입설명
dxint—
dyint—
dzint—

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

상수설명
SUCCESSThe interaction happened; the player's arm swings.
CONSUMEThe interaction happened without an arm swing.
PASSNothing happened; the game continues with its default behaviour.
FAILThe 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.

구성 요소타입설명
versionintthe current data version; saved data of an older version runs migration
migrationOptional<DataMigration>upgrades older data, if any
syncToClientsbooleanwhether every player's client gets a read-only copy, updated on StoredData.markChanged()
상수·필드타입설명
DEFAULTStorageOptionsVersion 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.

인자타입설명
valueint—
upgradeDataMigration—

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

구성 요소타입설명
xdoubleeast (+) / west (-)
ydoubleup (+) / down (-)
zdoublesouth (+) / north (-)
상수·필드타입설명
ZEROVector3No 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.

인자타입설명
posBlockPos—

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

인자타입설명
posBlockPos—
blockResourceId—

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

인자타입설명
posBlockPos—

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

인자타입설명
posBlockPos—
propertyBlockProperty<T>—
valueT—

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

인자타입설명
posBlockPos—

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

인자타입설명
idResourceId—

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

인자타입설명
ticksint—
taskRunnable—

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

인자타입설명
idResourceId—
optionsStorageOptions—

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

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

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

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

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

인자타입설명
posBlockPos—
soundResourceId—
volumefloat—
pitchfloat—

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

인자타입설명
particleResourceId—
xdouble—
ydouble—
zdouble—
countint—
spreaddoublerandom 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.

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

인자타입설명
ruleGameRuleKey<T>—
valueT—

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

인자타입설명
chunkXint—
chunkZint—
forcedboolean—

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

인자타입설명
chunkXint—
chunkZint—

반환 boolean

biomeAt(BlockPos)​

ResourceId biomeAt(BlockPos pos)

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

The biome at pos, for example minecraft:plains.

인자타입설명
posBlockPos—

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

인자타입설명
posBlockPos—
tagTagKey—

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

인자타입설명
posBlockPos—

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

인자타입설명
posBlockPos—
categoryMobCategory—

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

인자타입설명
dimensionResourceId—

반환 Optional<WorldView>

Buy me a coffee