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
AssetManager
Loaded game assets
IAssetManager AssetManager { get; }
Property Value
BlockAccessor
Access blocks and other world data from loaded chunks, fault tolerant
IBlockAccessor BlockAccessor { get; }
Property Value
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
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
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
ChunkProvider
IChunkProvider ChunkProvider { get; }
Property Value
Claims
The land claiming api interface
ILandClaimAPI Claims { get; }
Property Value
ClassRegistry
Interface to create instance of certain classes
IClassRegistryAPI ClassRegistry { get; }
Property Value
Collectibles
List of all loaded blocks and items without placeholders
List<CollectibleObject> Collectibles { get; }
Property Value
CollisionTester
For collision testing in the main thread
CollisionTester CollisionTester { get; }
Property Value
Config
The current world config
ITreeAttribute Config { get; }
Property Value
DefaultEntityTrackingRange
The range in blocks within a client will receive regular updates for an entity
int DefaultEntityTrackingRange { get; }
Property Value
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
ElapsedMilliseconds
Amount of milliseconds ellapsed since startup
long ElapsedMilliseconds { get; }
Property Value
EntityDebugMode
Whether the current side (client/server) is in entity debug mode
bool EntityDebugMode { get; }
Property Value
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
EntityTypes
List of all loaded entity types.
List<EntityProperties> EntityTypes { get; }
Property Value
FrameProfiler
Gets the frame profiler utility.
FrameProfilerUtil FrameProfiler { get; }
Property Value
GridRecipes
List of all loaded crafting recipes
List<GridRecipe> GridRecipes { get; }
Property Value
InteresectionTester
Utility for testing intersections. Only access from main thread.
AABBIntersectionTest InteresectionTester { get; }
Property Value
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
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
Rand
Just a random number generator. Makes use of ThreadLocal for thread safety.
Random Rand { get; }
Property Value
SavegameIdentifier
A globally unique identifier for this savegame
string SavegameIdentifier { get; }
Property Value
SeaLevel
The currently configured sea level (y-coordinate)
int SeaLevel { get; }
Property Value
Seed
The world seed. Accessible on the server and the client
int Seed { get; }
Property Value
Side
The current side (client/server)
EnumAppSide Side { get; }
Property Value
SunBrightness
The currently configured max sun light level
int SunBrightness { get; }
Property Value
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
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
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
boolWhether or not a call to Setblock should send the update also to all connected clients
relight
boolWhether or not to relight the chunk after a call to SetBlock and the light values changed by that
strict
boolLog an error message if GetBlock/SetBlock was called to an unloaded chunk
debug
boolIf strict, crashes the server if a unloaded chunk was crashed, prints an exception and exports a png image of the current loaded chunks
Returns
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
Returns
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
boolWhether or not a call to Setblock should send the update also to all connected clients
relight
boolWhether or not to relight the chunk after the a call to SetBlock and the light values changed by that
debug
bool
Returns
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
Returns
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
boolWhether or not a call to Setblock should send the update also to all connected clients
relight
boolWhether or not to relight the chunk after a call to SetBlock and the light values changed by that
Returns
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
boolWhether or not a call to Setblock should send the update also to all connected clients
relight
boolWhether or not to relight the chunk after a call to SetBlock and the light values changed by that
debug
bool
Returns
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
Returns
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
Vec3dhorRange
floatvertRange
floatmatches
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
BlockPosendPos
BlockPosmatches
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
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
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
BlockPoscollisionBoxes
Cuboidf[]matches
ActionConsumable<Entity>
Returns
- Entity[]
GetItem(int)
Retrieve the item class from given item id
Item GetItem(int itemId)
Parameters
itemId
int
Returns
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
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
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
Vec3dhorRange
floatvertRange
floatmatches
ActionConsumable<Entity>
Returns
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
Vec3dhorRange
floatvertRange
floatmatches
ActionConsumable<IPlayer>
Returns
- IPlayer[]
GetRecipeRegistry(string)
Retrieve a previously registered recipe registry
RecipeRegistryBase GetRecipeRegistry(string code)
Parameters
code
string
Returns
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
IPlayerhighlightSlotId
intfor multiple highlights use a different number
blocks
List<BlockPos>colors
List<int>mode
EnumHighlightBlocksModeshape
EnumHighlightShapescale
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
IPlayerhighlightSlotId
intfor multiple highlights use a different number
blocks
List<BlockPos>mode
EnumHighlightBlocksModeshape
EnumHighlightShapeWhen 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
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
AssetLocationThe sound path, without sounds/ prefix or the .ogg ending
posx
doubleposy
doubleposz
doubledualCallByPlayer
IPlayerIf 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
boolrange
floatThe 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
AssetLocationposx
doubleposy
doubleposz
doubledualCallByPlayer
IPlayerpitch
floatrange
floatvolume
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
AssetLocationposx
doubleposy
doubleposz
doubledualCallByPlayer
IPlayersoundType
EnumSoundTypepitch
floatrange
floatvolume
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
AssetLocationThe sound path, without sounds/ prefix or the .ogg ending
atEntity
EntitydualCallByPlayer
IPlayerIf 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
boolrange
floatThe 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
AssetLocationatEntity
EntitydualCallByPlayer
IPlayerpitch
floatrange
floatvolume
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
AssetLocationThe sound path, without sounds/ prefix or the .ogg ending
atPlayer
IPlayerdualCallByPlayer
IPlayerIf 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
boolrange
floatThe 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
AssetLocationThe sound path, without sounds/ prefix or the .ogg ending
pos
BlockPosyOffsetFromCenter
doubleHow much above or below the central Y position of the block to play
dualCallByPlayer
IPlayerIf 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
boolrange
floatThe 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
AssetLocationThe sound path, without sounds/ prefix or the .ogg ending
forPlayer
IPlayerrandomizePitch
boolrange
floatThe 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
AssetLocationforPlayer
IPlayerpitch
floatrange
floatvolume
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
PlayerHasPrivilege(int, string)
Returns true if given client has a privilege. Always returns true on the client.
bool PlayerHasPrivilege(int clientid, string privilege)
Parameters
Returns
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
IWorldIntersectionSupplierfromPos
Vec3dtoPos
Vec3dblockSelection
BlockSelectionentitySelection
EntitySelectionbfilter
BlockFilterCan be used to ignore certain blocks. Return false to ignore
efilter
EntityFilterCan 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
RayblockSelection
BlockSelectionentitySelection
EntitySelectionfilter
BlockFilterefilter
EntityFilterCan 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
Vec3dpitch
floatyaw
floatrange
floatblockSelection
BlockSelectionentitySelection
EntitySelectionbfilter
BlockFilterCan be used to ignore certain blocks. Return false to ignore
efilter
EntityFilterCan 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
Vec3dtoPos
Vec3dblockSelection
BlockSelectionentitySelection
EntitySelectionbfilter
BlockFilterCan be used to ignore certain blocks. Return false to ignore
efilter
EntityFilterCan 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
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
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
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
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
BlockPosThe position of the block to take the color from
pos
Vec3dThe position where the particles should spawn
radius
floatquantity
intscale
floatdualCallByPlayer
IPlayerIf 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
Vec3dThe position where the particles should spawn
item
ItemStackradius
floatquantity
intscale
floatdualCallByPlayer
IPlayerIf 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
Returns
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
Returns
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
floatcolor
intminPos
Vec3dmaxPos
Vec3dminVelocity
Vec3fmaxVelocity
Vec3flifeLength
floatgravityEffect
floatscale
floatmodel
EnumParticleModeldualCallByPlayer
IPlayerIf 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
IParticlePropertiesProviderdualCallByPlayer
IPlayerIf 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)