Table of Contents

Interface IWorldAccessor

Namespace
Vintagestory.API.Common
Assembly
VintagestoryAPI.dll

Important interface to access the game world.

public interface IWorldAccessor
Extension Methods

Properties

AllOnlinePlayers

Gets a list of all online players. Warning: Also returns currently connecting player whose player data may not have been fully initialized. Check for player.ConnectionState to avoid these.

IPlayer[] AllOnlinePlayers { get; }

Property Value

IPlayer[]

Array containing the IDs of online players

AllPlayers

Gets a list of all players that connected to this server at least once while the server was running. When called client side you will receive the same as AllOnlinePlayers

IPlayer[] AllPlayers { get; }

Property Value

IPlayer[]

Array containing the IDs of online players

Api

The api interface

ICoreAPI Api { get; }

Property Value

ICoreAPI

AssetManager

Loaded game assets

IAssetManager AssetManager { get; }

Property Value

IAssetManager

BlockAccessor

Access blocks and other world data from loaded chunks, fault tolerant

IBlockAccessor BlockAccessor { get; }

Property Value

IBlockAccessor

BlockLightLevels

The currently configured block light brightness levels

float[] BlockLightLevels { get; }

Property Value

float[]

Blocks

List of all loaded blocks. The array index is the block id. Some may be null or placeholders (then block.code is null). Client-side none are null, what was null return as air blocks.

IList<Block> Blocks { get; }

Property Value

IList<Block>

BulkBlockAccessor

Fault tolerant bulk block access to the worlds block data. Since this is a single bulk block access instance the cached data is shared for everything accessing this method, hence should only be accessed from the main thread and any changed comitted within the same game tick. You can however use the WorldManager api to get your own instance of a bulk block accessor

IBulkBlockAccessor BulkBlockAccessor { get; }

Property Value

IBulkBlockAccessor

Calendar

Interface to access the game calendar. On the server side only available after run stage 'LoadGamePre' (before that it is null)

IGameCalendar Calendar { get; }

Property Value

IGameCalendar

ChunkProvider

IChunkProvider ChunkProvider { get; }

Property Value

IChunkProvider

Claims

The land claiming api interface

ILandClaimAPI Claims { get; }

Property Value

ILandClaimAPI

ClassRegistry

Interface to create instance of certain classes

IClassRegistryAPI ClassRegistry { get; }

Property Value

IClassRegistryAPI

Collectibles

List of all loaded blocks and items without placeholders

List<CollectibleObject> Collectibles { get; }

Property Value

List<CollectibleObject>

CollisionTester

For collision testing in the main thread

CollisionTester CollisionTester { get; }

Property Value

CollisionTester

Config

The current world config

ITreeAttribute Config { get; }

Property Value

ITreeAttribute

DefaultEntityTrackingRange

The range in blocks within a client will receive regular updates for an entity

int DefaultEntityTrackingRange { get; }

Property Value

int

DefaultSpawnPosition

The default spawn position as sent by the server (usually the map middle). Does not take player specific spawn point into account

EntityPos DefaultSpawnPosition { get; }

Property Value

EntityPos

ElapsedMilliseconds

Amount of milliseconds ellapsed since startup

long ElapsedMilliseconds { get; }

Property Value

long

EntityDebugMode

Whether the current side (client/server) is in entity debug mode

bool EntityDebugMode { get; }

Property Value

bool

EntityTypeCodes

List of the codes of all loaded entity types, in the AssetLocation short string format (e.g. "creature" for entities with domain game:, "domain:creature" for entities with other domains)

List<string> EntityTypeCodes { get; }

Property Value

List<string>

EntityTypes

List of all loaded entity types.

List<EntityProperties> EntityTypes { get; }

Property Value

List<EntityProperties>

FrameProfiler

Gets the frame profiler utility.

FrameProfilerUtil FrameProfiler { get; }

Property Value

FrameProfilerUtil

GridRecipes

List of all loaded crafting recipes

List<GridRecipe> GridRecipes { get; }

Property Value

List<GridRecipe>

InteresectionTester

Utility for testing intersections. Only access from main thread.

AABBIntersectionTest InteresectionTester { get; }

Property Value

AABBIntersectionTest

Items

List of all loaded items. The array index is the item id. Some may be placeholders (then item.code is null). Server-side, some may be null; client-side, a check for item == null is not necessary.

IList<Item> Items { get; }

Property Value

IList<Item>

LoadedChunkIndices

Returns a list all loaded chunk positions in the form of a long index. Code to turn that into x/y/z coords: Vec3i coords = new Vec3i( (int)(chunkIndex3d % ChunkMapSizeX), (int)(chunkIndex3d / ((long)ChunkMapSizeX * ChunkMapSizeZ)), (int)((chunkIndex3d / ChunkMapSizeX) % ChunkMapSizeZ) ); Retrieving the list is not a very fast process, not suggested to be called every frame

long[] LoadedChunkIndices { get; }

Property Value

long[]

LoadedMapChunkIndices

Returns a list all loaded chunk positions in the form of a long index

long[] LoadedMapChunkIndices { get; }

Property Value

long[]

Logger

Logging Utility

ILogger Logger { get; }

Property Value

ILogger

Rand

Just a random number generator. Makes use of ThreadLocal for thread safety.

Random Rand { get; }

Property Value

Random

SavegameIdentifier

A globally unique identifier for this savegame

string SavegameIdentifier { get; }

Property Value

string

SeaLevel

The currently configured sea level (y-coordinate)

int SeaLevel { get; }

Property Value

int

Seed

The world seed. Accessible on the server and the client

int Seed { get; }

Property Value

int

Side

The current side (client/server)

EnumAppSide Side { get; }

Property Value

EnumAppSide

SunBrightness

The currently configured max sun light level

int SunBrightness { get; }

Property Value

int

SunLightLevels

The currently configured sun light brightness levels

float[] SunLightLevels { get; }

Property Value

float[]

Methods

GetBlock(int)

Retrieve the block class from given block id

Block GetBlock(int blockId)

Parameters

blockId int

Returns

Block

GetBlock(AssetLocation)

Retrieve the block class from given block code. Will return null if the block does not exist. Logs a warning if block does not exist

Block GetBlock(AssetLocation blockCode)

Parameters

blockCode AssetLocation

Returns

Block

GetBlockAccessor(bool, bool, bool, bool)

Retrieve a customized interface to access blocks in the loaded game world.

IBlockAccessor GetBlockAccessor(bool synchronize, bool relight, bool strict, bool debug = false)

Parameters

synchronize bool

Whether or not a call to Setblock should send the update also to all connected clients

relight bool

Whether or not to relight the chunk after a call to SetBlock and the light values changed by that

strict bool

Log an error message if GetBlock/SetBlock was called to an unloaded chunk

debug bool

If strict, crashes the server if a unloaded chunk was crashed, prints an exception and exports a png image of the current loaded chunks

Returns

IBlockAccessor

GetBlockAccessorBulkMinimalUpdate(bool, bool)

Retrieve a customized interface to access blocks in the loaded game world. Does not relight. On commit all touched blocks are updated at once. This method is currently used for the snow accumulation system

IBulkBlockAccessor GetBlockAccessorBulkMinimalUpdate(bool synchronize, bool debug = false)

Parameters

synchronize bool
debug bool

Returns

IBulkBlockAccessor

GetBlockAccessorBulkUpdate(bool, bool, bool)

Retrieve a customized interface to access blocks in the loaded game world. Does not to relight/sync on a SetBlock until Commit() is called. On commit all touched blocks are relit/synced at once. This method should be used when setting many blocks (e.g. tree generation, explosion, etc.).

IBulkBlockAccessor GetBlockAccessorBulkUpdate(bool synchronize, bool relight, bool debug = false)

Parameters

synchronize bool

Whether or not a call to Setblock should send the update also to all connected clients

relight bool

Whether or not to relight the chunk after the a call to SetBlock and the light values changed by that

debug bool

Returns

IBulkBlockAccessor

GetBlockAccessorMapChunkLoading(bool, bool)

Retrieve a special Bulk blockaccessor which can have the chunks it accesses directly provided to it from a loading mapchunk. On commit all touched blocks are updated at once. This method is currently used for the snow accumulation system

IBulkBlockAccessor GetBlockAccessorMapChunkLoading(bool synchronize, bool debug = false)

Parameters

synchronize bool
debug bool

Returns

IBulkBlockAccessor

GetBlockAccessorPrefetch(bool, bool)

Same as GetBlockAccessor but you have to call PrefetchBlocks() before using GetBlock(). It pre-loads all blocks in given area resulting in faster GetBlock() access

IBlockAccessorPrefetch GetBlockAccessorPrefetch(bool synchronize, bool relight)

Parameters

synchronize bool

Whether or not a call to Setblock should send the update also to all connected clients

relight bool

Whether or not to relight the chunk after a call to SetBlock and the light values changed by that

Returns

IBlockAccessorPrefetch

GetBlockAccessorRevertable(bool, bool, bool)

Same as GetBlockAccessorBulkUpdate, additionally, each Commit() stores the previous state and you can perform undo/redo operations on these.

IBlockAccessorRevertable GetBlockAccessorRevertable(bool synchronize, bool relight, bool debug = false)

Parameters

synchronize bool

Whether or not a call to Setblock should send the update also to all connected clients

relight bool

Whether or not to relight the chunk after a call to SetBlock and the light values changed by that

debug bool

Returns

IBlockAccessorRevertable

GetCachingBlockAccessor(bool, bool)

Same as the normal block accessor but remembers the previous chunk that was accessed. This can give you a 10-50% performance boosts when you scan many blocks in tight loops DONT FORGET: Call .Begin() before getting/setting in a tight loop. Not calling it can cause the game to crash

ICachingBlockAccessor GetCachingBlockAccessor(bool synchronize, bool relight)

Parameters

synchronize bool
relight bool

Returns

ICachingBlockAccessor

GetEntitiesAround(Vec3d, float, float, ActionConsumable<Entity>)

Retrieve all entities within given range and given matcher method. If now matcher method is supplied, all entities are returned.

Entity[] GetEntitiesAround(Vec3d position, float horRange, float vertRange, ActionConsumable<Entity> matches = null)

Parameters

position Vec3d
horRange float
vertRange float
matches ActionConsumable<Entity>

Returns

Entity[]

GetEntitiesInsideCuboid(BlockPos, BlockPos, ActionConsumable<Entity>)

Retrieve all entities within a cuboid bound by startPos and endPos. If now matcher method is supplied, all entities are returned.

Entity[] GetEntitiesInsideCuboid(BlockPos startPos, BlockPos endPos, ActionConsumable<Entity> matches = null)

Parameters

startPos BlockPos
endPos BlockPos
matches ActionConsumable<Entity>

Returns

Entity[]

GetEntityById(long)

Retrieve an entity by its unique id, returns null if no such entity exists or hasn't been loaded

Entity GetEntityById(long entityId)

Parameters

entityId long

Returns

Entity

GetEntityType(AssetLocation)

Retrieve the entity class from given entity code. Will return null if the entity does not exist.

EntityProperties GetEntityType(AssetLocation entityCode)

Parameters

entityCode AssetLocation

Returns

EntityProperties

GetIntersectingEntities(BlockPos, Cuboidf[], ActionConsumable<Entity>)

Retrieves the first found entity that intersects any of the supplied collisionboxes offseted by basePos. This is a helper method for you to determine if you can place a block at given position. You can also implement it yourself with intersection testing and GetEntitiesAround()

Entity[] GetIntersectingEntities(BlockPos basePos, Cuboidf[] collisionBoxes, ActionConsumable<Entity> matches = null)

Parameters

basePos BlockPos
collisionBoxes Cuboidf[]
matches ActionConsumable<Entity>

Returns

Entity[]

GetItem(int)

Retrieve the item class from given item id

Item GetItem(int itemId)

Parameters

itemId int

Returns

Item

GetItem(AssetLocation)

Retrieve the item class from given item code. Will return null if the item does not exist.

Item GetItem(AssetLocation itemCode)

Parameters

itemCode AssetLocation

Returns

Item

GetLockFreeBlockAccessor()

This block accessor is read only and does not use lock() or chunk.Unpack() in order to make it very fast. This comes at the cost of sometimes reading invalid data (block id = 0) when the chunk is packed or being packed.

IBlockAccessor GetLockFreeBlockAccessor()

Returns

IBlockAccessor

GetNearestEntity(Vec3d, float, float, ActionConsumable<Entity>)

Retrieve the nearest entity within given range and given matcher method

Entity GetNearestEntity(Vec3d position, float horRange, float vertRange, ActionConsumable<Entity> matches = null)

Parameters

position Vec3d
horRange float
vertRange float
matches ActionConsumable<Entity>

Returns

Entity

GetPlayersAround(Vec3d, float, float, ActionConsumable<IPlayer>)

Retrieve all players within given range and given matcher method. This method is faster than when using GetEntitiesAround with a matcher for players

IPlayer[] GetPlayersAround(Vec3d position, float horRange, float vertRange, ActionConsumable<IPlayer> matches = null)

Parameters

position Vec3d
horRange float
vertRange float
matches ActionConsumable<IPlayer>

Returns

IPlayer[]

GetRecipeRegistry(string)

Retrieve a previously registered recipe registry

RecipeRegistryBase GetRecipeRegistry(string code)

Parameters

code string

Returns

RecipeRegistryBase

HighlightBlocks(IPlayer, int, List<BlockPos>, List<int>, EnumHighlightBlocksMode, EnumHighlightShape, float)

Sends given player a list of block positions that should be highlighted

void HighlightBlocks(IPlayer player, int highlightSlotId, List<BlockPos> blocks, List<int> colors, EnumHighlightBlocksMode mode = EnumHighlightBlocksMode.Absolute, EnumHighlightShape shape = EnumHighlightShape.Arbitrary, float scale = 1)

Parameters

player IPlayer
highlightSlotId int

for multiple highlights use a different number

blocks List<BlockPos>
colors List<int>
mode EnumHighlightBlocksMode
shape EnumHighlightShape
scale float

HighlightBlocks(IPlayer, int, List<BlockPos>, EnumHighlightBlocksMode, EnumHighlightShape)

Sends given player a list of block positions that should be highlighted (using a default color)

void HighlightBlocks(IPlayer player, int highlightSlotId, List<BlockPos> blocks, EnumHighlightBlocksMode mode = EnumHighlightBlocksMode.Absolute, EnumHighlightShape shape = EnumHighlightShape.Arbitrary)

Parameters

player IPlayer
highlightSlotId int

for multiple highlights use a different number

blocks List<BlockPos>
mode EnumHighlightBlocksMode
shape EnumHighlightShape

When arbitrary, the blocks list represents the blocks to be highlighted. When Cube the blocks list should contain 2 positions for start and end

NearestPlayer(double, double, double)

Find the nearest player to the given position

IPlayer NearestPlayer(double x, double y, double z)

Parameters

x double

x coordinate

y double

y coordinate

z double

z coordinate

Returns

IPlayer

ID of the nearest player

PlaySoundAt(AssetLocation, double, double, double, IPlayer, bool, float, float)

Plays given sound at given position.

void PlaySoundAt(AssetLocation location, double posx, double posy, double posz, IPlayer dualCallByPlayer = null, bool randomizePitch = true, float range = 32, float volume = 1)

Parameters

location AssetLocation

The sound path, without sounds/ prefix or the .ogg ending

posx double
posy double
posz double
dualCallByPlayer IPlayer

If this call is made on client and on server, set this the causing playerUID to prevent double playing. Essentially dualCall will play the sound on the client, and send it to all other players except source client

randomizePitch bool
range float

The range at which the gain will be attenuated to 1% of the supplied volume

volume float

PlaySoundAt(AssetLocation, double, double, double, IPlayer, float, float, float)

Plays given sound at given position.

void PlaySoundAt(AssetLocation location, double posx, double posy, double posz, IPlayer dualCallByPlayer, float pitch, float range = 32, float volume = 1)

Parameters

location AssetLocation
posx double
posy double
posz double
dualCallByPlayer IPlayer
pitch float
range float
volume float

PlaySoundAt(AssetLocation, double, double, double, IPlayer, EnumSoundType, float, float, float)

void PlaySoundAt(AssetLocation location, double posx, double posy, double posz, IPlayer dualCallByPlayer, EnumSoundType soundType, float pitch, float range = 32, float volume = 1)

Parameters

location AssetLocation
posx double
posy double
posz double
dualCallByPlayer IPlayer
soundType EnumSoundType
pitch float
range float
volume float

PlaySoundAt(AssetLocation, Entity, IPlayer, bool, float, float)

Plays given sound at given position.

void PlaySoundAt(AssetLocation location, Entity atEntity, IPlayer dualCallByPlayer = null, bool randomizePitch = true, float range = 32, float volume = 1)

Parameters

location AssetLocation

The sound path, without sounds/ prefix or the .ogg ending

atEntity Entity
dualCallByPlayer IPlayer

If this call is made on client and on server, set this the causing playerUID to prevent double playing. Essentially dualCall will play the sound on the client, and send it to all other players except source client

randomizePitch bool
range float

The range at which the gain will be attenuated to 1% of the supplied volume

volume float

PlaySoundAt(AssetLocation, Entity, IPlayer, float, float, float)

Plays given sound at given position.

void PlaySoundAt(AssetLocation location, Entity atEntity, IPlayer dualCallByPlayer, float pitch, float range = 32, float volume = 1)

Parameters

location AssetLocation
atEntity Entity
dualCallByPlayer IPlayer
pitch float
range float
volume float

PlaySoundAt(AssetLocation, IPlayer, IPlayer, bool, float, float)

Plays given sound at given player position.

void PlaySoundAt(AssetLocation location, IPlayer atPlayer, IPlayer dualCallByPlayer = null, bool randomizePitch = true, float range = 32, float volume = 1)

Parameters

location AssetLocation

The sound path, without sounds/ prefix or the .ogg ending

atPlayer IPlayer
dualCallByPlayer IPlayer

If this call is made on client and on server, set this the causing playerUID to prevent double playing. Essentially dualCall will play the sound on the client, and send it to all other players except source client

randomizePitch bool
range float

The range at which the gain will be attenuated to 1% of the supplied volume

volume float

PlaySoundAt(AssetLocation, BlockPos, double, IPlayer, bool, float, float)

Plays given sound at given position - dimension aware. Plays at the center of the BlockPos

void PlaySoundAt(AssetLocation location, BlockPos pos, double yOffsetFromCenter, IPlayer dualCallByPlayer = null, bool randomizePitch = true, float range = 32, float volume = 1)

Parameters

location AssetLocation

The sound path, without sounds/ prefix or the .ogg ending

pos BlockPos
yOffsetFromCenter double

How much above or below the central Y position of the block to play

dualCallByPlayer IPlayer

If this call is made on client and on server, set this the causing playerUID to prevent double playing. Essentially dualCall will play the sound on the client, and send it to all other players except source client

randomizePitch bool
range float

The range at which the gain will be attenuated to 1% of the supplied volume

volume float

PlaySoundFor(AssetLocation, IPlayer, bool, float, float)

Plays given sound only for given player. Useful when called server side, for the client side there is no difference over using PlaySoundAt or PlaySoundFor

void PlaySoundFor(AssetLocation location, IPlayer forPlayer, bool randomizePitch = true, float range = 32, float volume = 1)

Parameters

location AssetLocation

The sound path, without sounds/ prefix or the .ogg ending

forPlayer IPlayer
randomizePitch bool
range float

The range at which the gain will be attenuated to 1% of the supplied volume

volume float

PlaySoundFor(AssetLocation, IPlayer, float, float, float)

void PlaySoundFor(AssetLocation location, IPlayer forPlayer, float pitch, float range = 32, float volume = 1)

Parameters

location AssetLocation
forPlayer IPlayer
pitch float
range float
volume float

PlayerByUid(string)

Retrieves the worldplayer data object of given player. When called server side the player does not need to be connected.

IPlayer PlayerByUid(string playerUid)

Parameters

playerUid string

Returns

IPlayer

PlayerHasPrivilege(int, string)

Returns true if given client has a privilege. Always returns true on the client.

bool PlayerHasPrivilege(int clientid, string privilege)

Parameters

clientid int
privilege string

Returns

bool

RayTraceForSelection(IWorldIntersectionSupplier, Vec3d, Vec3d, ref BlockSelection, ref EntitySelection, BlockFilter, EntityFilter)

Shoots out a virtual ray at between given positions and stops when the ray hits a block or entity intersection box supplied by given supplier. The block/entity it struck first is then returned by reference.

void RayTraceForSelection(IWorldIntersectionSupplier supplier, Vec3d fromPos, Vec3d toPos, ref BlockSelection blockSelection, ref EntitySelection entitySelection, BlockFilter bfilter = null, EntityFilter efilter = null)

Parameters

supplier IWorldIntersectionSupplier
fromPos Vec3d
toPos Vec3d
blockSelection BlockSelection
entitySelection EntitySelection
bfilter BlockFilter

Can be used to ignore certain blocks. Return false to ignore

efilter EntityFilter

Can be used to ignore certain entities. Return false to ignore

RayTraceForSelection(Ray, ref BlockSelection, ref EntitySelection, BlockFilter, EntityFilter)

Shoots out a given ray and stops when the ray hits a block or entity selection box. The block/entity it struck first is then returned by reference.

void RayTraceForSelection(Ray ray, ref BlockSelection blockSelection, ref EntitySelection entitySelection, BlockFilter filter = null, EntityFilter efilter = null)

Parameters

ray Ray
blockSelection BlockSelection
entitySelection EntitySelection
filter BlockFilter
efilter EntityFilter

Can be used to ignore certain entities. Return false to ignore

RayTraceForSelection(Vec3d, float, float, float, ref BlockSelection, ref EntitySelection, BlockFilter, EntityFilter)

Shoots out a virtual ray at given position and angle and stops when the ray hits a block or entity selection box. The block/entity it struck first is then returned by reference.

void RayTraceForSelection(Vec3d fromPos, float pitch, float yaw, float range, ref BlockSelection blockSelection, ref EntitySelection entitySelection, BlockFilter bfilter = null, EntityFilter efilter = null)

Parameters

fromPos Vec3d
pitch float
yaw float
range float
blockSelection BlockSelection
entitySelection EntitySelection
bfilter BlockFilter

Can be used to ignore certain blocks. Return false to ignore

efilter EntityFilter

Can be used to ignore certain entities. Return false to ignore

RayTraceForSelection(Vec3d, Vec3d, ref BlockSelection, ref EntitySelection, BlockFilter, EntityFilter)

Shoots out a virtual ray at between given positions and stops when the ray hits a block or entity selection box. The block/entity it struck first is then returned by reference.

void RayTraceForSelection(Vec3d fromPos, Vec3d toPos, ref BlockSelection blockSelection, ref EntitySelection entitySelection, BlockFilter bfilter = null, EntityFilter efilter = null)

Parameters

fromPos Vec3d
toPos Vec3d
blockSelection BlockSelection
entitySelection EntitySelection
bfilter BlockFilter

Can be used to ignore certain blocks. Return false to ignore

efilter EntityFilter

Can be used to ignore certain entities. Return false to ignore

RegisterCallback(Action<float>, int)

Calls given method after supplied amount of milliseconds. The engine may call your method slightly later since these event are handled only during fixed interval game ticks.

long RegisterCallback(Action<float> OnTimePassed, int millisecondDelay)

Parameters

OnTimePassed Action<float>
millisecondDelay int

Returns

long

listenerId

RegisterCallback(Action<IWorldAccessor, BlockPos, float>, BlockPos, int)

Calls given method after supplied amount of milliseconds, lets you supply a block position to be passed to the method. The engine may call your method slightly later since these event are handled only during fixed interval game ticks.

long RegisterCallback(Action<IWorldAccessor, BlockPos, float> OnTimePassed, BlockPos pos, int millisecondDelay)

Parameters

OnTimePassed Action<IWorldAccessor, BlockPos, float>
pos BlockPos
millisecondDelay int

Returns

long

listenerId

RegisterCallbackUnique(Action<IWorldAccessor, BlockPos, float>, BlockPos, int)

Calls given method after supplied amount of milliseconds. The engine may call your method slightly later since these event are handled only during fixed interval game ticks. Ignores any subsequent registers for the same blockpos while a callback is still in the queue. Used e.g. for liquid physics to prevent unnecessary multiple updates

long RegisterCallbackUnique(Action<IWorldAccessor, BlockPos, float> OnGameTick, BlockPos pos, int millisecondInterval)

Parameters

OnGameTick Action<IWorldAccessor, BlockPos, float>
pos BlockPos
millisecondInterval int

Returns

long

listenerId

RegisterGameTickListener(Action<float>, int, int)

Calls given method after every given interval until unregistered. The engine may call your method slightly later since these event are handled only during fixed interval game ticks.

long RegisterGameTickListener(Action<float> onGameTick, int millisecondInterval, int initialDelayOffsetMs = 0)

Parameters

onGameTick Action<float>
millisecondInterval int
initialDelayOffsetMs int

Returns

long

listenerId

SearchBlocks(AssetLocation)

Returns all blocktypes matching given wildcard

Block[] SearchBlocks(AssetLocation wildcard)

Parameters

wildcard AssetLocation

Returns

Block[]

SearchItems(AssetLocation)

Returns all item types matching given wildcard

Item[] SearchItems(AssetLocation wildcard)

Parameters

wildcard AssetLocation

Returns

Item[]

SpawnCubeParticles(BlockPos, Vec3d, float, int, float, IPlayer, Vec3f)

Spawn a bunch of particles colored by the block at given position

void SpawnCubeParticles(BlockPos blockPos, Vec3d pos, float radius, int quantity, float scale = 1, IPlayer dualCallByPlayer = null, Vec3f velocity = null)

Parameters

blockPos BlockPos

The position of the block to take the color from

pos Vec3d

The position where the particles should spawn

radius float
quantity int
scale float
dualCallByPlayer IPlayer

If this call is made on client and on server, set this to the causing playerUID to prevent double spawning. Essentially dualCall will spawn the particles on the client, and send it to all other players except source client

velocity Vec3f

SpawnCubeParticles(Vec3d, ItemStack, float, int, float, IPlayer, Vec3f)

Spawn a bunch of particles colored by given itemstack

void SpawnCubeParticles(Vec3d pos, ItemStack item, float radius, int quantity, float scale = 1, IPlayer dualCallByPlayer = null, Vec3f velocity = null)

Parameters

pos Vec3d

The position where the particles should spawn

item ItemStack
radius float
quantity int
scale float
dualCallByPlayer IPlayer

If this call is made on client and on server, set this to the causing playerUID to prevent double spawning. Essentially dualCall will spawn the particles on the client, and send it to all other players except source client

velocity Vec3f

SpawnEntity(Entity)

Creates a new entity. It's the responsibility of the given Entity to call set it's EntityType. This should be done inside it's Initialize method before base.Initialize is called.

void SpawnEntity(Entity entity)

Parameters

entity Entity

SpawnItemEntity(ItemStack, BlockPos, Vec3d)

Spawns a dropped itemstack at given position. Will immediately disappear if stacksize==0 Returns the entity spawned (may be null!)

Entity SpawnItemEntity(ItemStack itemstack, BlockPos pos, Vec3d velocity = null)

Parameters

itemstack ItemStack
pos BlockPos
velocity Vec3d

Returns

Entity

SpawnItemEntity(ItemStack, Vec3d, Vec3d)

Spawns a dropped itemstack at given position. Will immediately disappear if stacksize==0 Returns the entity spawned (may be null!)

Entity SpawnItemEntity(ItemStack itemstack, Vec3d position, Vec3d velocity = null)

Parameters

itemstack ItemStack
position Vec3d
velocity Vec3d

Returns

Entity

SpawnParticles(float, int, Vec3d, Vec3d, Vec3f, Vec3f, float, float, float, EnumParticleModel, IPlayer)

Spawn a bunch of particles

void SpawnParticles(float quantity, int color, Vec3d minPos, Vec3d maxPos, Vec3f minVelocity, Vec3f maxVelocity, float lifeLength, float gravityEffect, float scale = 1, EnumParticleModel model = EnumParticleModel.Quad, IPlayer dualCallByPlayer = null)

Parameters

quantity float
color int
minPos Vec3d
maxPos Vec3d
minVelocity Vec3f
maxVelocity Vec3f
lifeLength float
gravityEffect float
scale float
model EnumParticleModel
dualCallByPlayer IPlayer

If this call is made on client and on server, set this to the causing playerUID to prevent double spawning. Essentially dualCall will spawn the particles on the client, and send it to all other players except source client

SpawnParticles(IParticlePropertiesProvider, IPlayer)

Spawn a bunch of particles

void SpawnParticles(IParticlePropertiesProvider particlePropertiesProvider, IPlayer dualCallByPlayer = null)

Parameters

particlePropertiesProvider IParticlePropertiesProvider
dualCallByPlayer IPlayer

If this call is made on client and on server, set this to the causing playerUID to prevent double spawning. Essentially dualCall will spawn the particles on the client, and send it to all other players except source client

UnregisterCallback(long)

Removes a delayed callback

void UnregisterCallback(long listenerId)

Parameters

listenerId long

UnregisterGameTickListener(long)

Removes a game tick listener

void UnregisterGameTickListener(long listenerId)

Parameters

listenerId long

UpdateEntityChunk(Entity, long)

Removes an entity from its old chunk and adds it to the chunk with newChunkIndex3d

void UpdateEntityChunk(Entity entity, long newChunkIndex3d)

Parameters

entity Entity
newChunkIndex3d long