Show / Hide Table of Contents

Class PersistentChunk

Inheritance
System.Object
WorldChunk
PersistentChunk
Implements
IChunk
Inherited Members
WorldChunk.ChunkAndBlockChangedEvent
WorldChunk.ChunkChangedEvent
WorldChunk.blocks
WorldChunk.SetBlockUnsafe(Block, Vector3i)
WorldChunk.SetBlock(Type, Vector3i, Object[])
WorldChunk.SetBlock<T>(Vector3i, Object[])
WorldChunk.DeleteBlock(Vector3i)
WorldChunk.ConvertBlocks()
WorldChunk.EncasesNeighbors()
WorldChunk.EncasesWaterNeighbors()
WorldChunk.ToString()
WorldChunk.Position
WorldChunk.Encasement
WorldChunk.LastUpdated
WorldChunk.Blocks
Namespace: Eco.World
Assembly: Eco.World.dll
Syntax
public class PersistentChunk : WorldChunk, IChunk

Constructors

PersistentChunk()

Declaration
public PersistentChunk()

PersistentChunk(PersistentChunkPack)

Declaration
public PersistentChunk(PersistentChunkPack container)
Parameters
Type Name Description
PersistentChunkPack container

Fields

NumIdleTicksBeforeFreezing

Declaration
public const int NumIdleTicksBeforeFreezing = 15
Field Value
Type Description
System.Int32

Properties

Active

Declaration
public bool Active { get; }
Property Value
Type Description
System.Boolean

ActiveChunks

Declaration
public static ConcurrentHashSet<PersistentChunk> ActiveChunks { get; }
Property Value
Type Description
ConcurrentCollections.ConcurrentHashSet<PersistentChunk>

Container

Declaration
public PersistentChunkPack Container { get; }
Property Value
Type Description
PersistentChunkPack

Frozen

Declaration
public bool Frozen { get; }
Property Value
Type Description
System.Boolean

HasTransientBlocks

Declaration
public bool HasTransientBlocks { get; }
Property Value
Type Description
System.Boolean

Methods

Convert(MigrationManager, Boolean)

Converts chunk from old format to new chunk format using migrationManager. It is required, because for optimization purposes chunk contains serialized blocks data, but when schema changes block ids may be changed as well.

Declaration
public void Convert(MigrationManager migrationManager, bool legacy)
Parameters
Type Name Description
MigrationManager migrationManager

Migration manager containing information about old and new schemas.

System.Boolean legacy

this flag used only for backward compatibility with 8.3, may be removed in 10.0.

Freeze()

Declaration
public void Freeze()

GetBlock(Vector3i)

Declaration
public override Block GetBlock(Vector3i localPosition)
Parameters
Type Name Description
Vector3i localPosition
Returns
Type Description
Block
Overrides
WorldChunk.GetBlock(Vector3i)

OnChanged()

Declaration
public override void OnChanged()
Overrides
WorldChunk.OnChanged()

OnDeserialized()

Declaration
protected void OnDeserialized()

OnNeighborEdgeChanged(Type)

Declaration
public void OnNeighborEdgeChanged(Type blockType)
Parameters
Type Name Description
System.Type blockType

PackIntoBson()

Declaration
public override BSONObject PackIntoBson()
Returns
Type Description
BSONObject
Overrides
WorldChunk.PackIntoBson()

RemoveTransientBlocks()

Declaration
public void RemoveTransientBlocks()

SetBlockInternal(Block, Vector3i)

Declaration
protected override void SetBlockInternal(Block block, Vector3i localPosition)
Parameters
Type Name Description
Block block
Vector3i localPosition
Overrides
WorldChunk.SetBlockInternal(Block, Vector3i)

SetContainer(PersistentChunkPack)

Declaration
public void SetContainer(PersistentChunkPack container)
Parameters
Type Name Description
PersistentChunkPack container

Thaw(Boolean)

It may not invalidate cache in case if it was thawed just for readonly access. Readonly access means that it have to make again array of blocks, but it doesnt changed anything, so cached bson bytes are still valid for sending to clients.

Declaration
public void Thaw(bool invalidateCache = true)
Parameters
Type Name Description
System.Boolean invalidateCache

TryFreeze()

Declaration
public void TryFreeze()

TryTick()

Declaration
public void TryTick()

UpdateHasTransientBlocks()

Recalculates if chunk has Transient blocks, updates HasTransientBlocks property and returns new value. If the chunk is frozen then just returns current value or false if undefined.

Declaration
public bool UpdateHasTransientBlocks()
Returns
Type Description
System.Boolean

WakeUp(Vector3i)

Declaration
public void WakeUp(Vector3i localPosition)
Parameters
Type Name Description
Vector3i localPosition

WakeUpFromNeighbour(Vector3i)

Declaration
public void WakeUpFromNeighbour(Vector3i localPosition)
Parameters
Type Name Description
Vector3i localPosition

Implements

IChunk
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾