forked from mirrors/NBTExplorer
Changed some identifier names from BlockXX to XX, since they're no longer part of an overloaded chunk interface.
This commit is contained in:
parent
b7eefbea0e
commit
d56fcc288f
9 changed files with 96 additions and 96 deletions
|
@ -48,7 +48,7 @@ namespace FlatMap
|
|||
|
||||
// Reset and rebuild the lighting for the entire chunk at once
|
||||
chunk.Blocks.RebuildBlockLight();
|
||||
chunk.Blocks.RebuildBlockSkyLight();
|
||||
chunk.Blocks.RebuildSkyLight();
|
||||
|
||||
Console.WriteLine("Built Chunk {0},{1}", chunk.X, chunk.Z);
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace FlatMap
|
|||
for (int y = 0; y < 2; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunk.Blocks.SetBlockID(x, y, z, (int)BlockType.BEDROCK);
|
||||
chunk.Blocks.SetID(x, y, z, (int)BlockType.BEDROCK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ namespace FlatMap
|
|||
for (int y = 2; y < height - 5; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunk.Blocks.SetBlockID(x, y, z, (int)BlockType.STONE);
|
||||
chunk.Blocks.SetID(x, y, z, (int)BlockType.STONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ namespace FlatMap
|
|||
for (int y = height - 5; y < height - 1; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunk.Blocks.SetBlockID(x, y, z, (int)BlockType.DIRT);
|
||||
chunk.Blocks.SetID(x, y, z, (int)BlockType.DIRT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ namespace FlatMap
|
|||
for (int y = height - 1; y < height; y++) {
|
||||
for (int x = 0; x < 16; x++) {
|
||||
for (int z = 0; z < 16; z++) {
|
||||
chunk.Blocks.SetBlockID(x, y, z, (int)BlockType.GRASS);
|
||||
chunk.Blocks.SetID(x, y, z, (int)BlockType.GRASS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Relight
|
|||
|
||||
chunk.Blocks.RebuildHeightMap();
|
||||
chunk.Blocks.ResetBlockLight();
|
||||
chunk.Blocks.ResetBlockSkyLight();
|
||||
chunk.Blocks.ResetSkyLight();
|
||||
cm.Save();
|
||||
|
||||
Console.WriteLine("Reset Chunk {0},{1}", chunk.X, chunk.Z);
|
||||
|
@ -42,7 +42,7 @@ namespace Relight
|
|||
if (chunk.X < -20 || chunk.X > 0 || chunk.Z < -20 || chunk.Z > 0) continue;
|
||||
|
||||
chunk.Blocks.RebuildBlockLight();
|
||||
chunk.Blocks.RebuildBlockSkyLight();
|
||||
chunk.Blocks.RebuildSkyLight();
|
||||
|
||||
// Save the chunk to disk so it doesn't hang around in RAM
|
||||
cm.Save();
|
||||
|
|
|
@ -122,8 +122,8 @@ namespace Substrate
|
|||
|
||||
public void SetBlock (int x, int y, int z, Block block)
|
||||
{
|
||||
SetBlockID(x, y, z, block.ID);
|
||||
SetBlockData(x, y, z, block.Data);
|
||||
SetID(x, y, z, block.ID);
|
||||
SetData(x, y, z, block.Data);
|
||||
|
||||
SetTileEntity(x, y, z, block.GetTileEntity().Copy());
|
||||
}
|
||||
|
@ -157,20 +157,20 @@ namespace Substrate
|
|||
|
||||
public void SetBlock (int x, int y, int z, IBlock block)
|
||||
{
|
||||
SetBlockID(x, y, z, block.ID);
|
||||
SetID(x, y, z, block.ID);
|
||||
}
|
||||
|
||||
public BlockInfo GetBlockInfo (int x, int y, int z)
|
||||
public BlockInfo GetInfo (int x, int y, int z)
|
||||
{
|
||||
return BlockInfo.BlockTable[_blocks[x, y, z]];
|
||||
}
|
||||
|
||||
public int GetBlockID (int x, int y, int z)
|
||||
public int GetID (int x, int y, int z)
|
||||
{
|
||||
return _blocks[x, y, z];
|
||||
}
|
||||
|
||||
public void SetBlockID (int x, int y, int z, int id)
|
||||
public void SetID (int x, int y, int z, int id)
|
||||
{
|
||||
int oldid = _blocks[x, y, z];
|
||||
if (oldid == id) {
|
||||
|
@ -223,14 +223,14 @@ namespace Substrate
|
|||
}
|
||||
|
||||
if (info1.Opacity != info2.Opacity) {
|
||||
UpdateBlockSkyLight(x, y, z);
|
||||
UpdateSkyLight(x, y, z);
|
||||
}
|
||||
}
|
||||
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
public int CountBlockID (int id)
|
||||
public int CountByID (int id)
|
||||
{
|
||||
int c = 0;
|
||||
for (int i = 0; i < _blocks.Length; i++) {
|
||||
|
@ -259,16 +259,16 @@ namespace Substrate
|
|||
|
||||
public void SetBlock (int x, int y, int z, IDataBlock block)
|
||||
{
|
||||
SetBlockID(x, y, z, block.ID);
|
||||
SetBlockData(x, y, z, block.Data);
|
||||
SetID(x, y, z, block.ID);
|
||||
SetData(x, y, z, block.Data);
|
||||
}
|
||||
|
||||
public int GetBlockData (int x, int y, int z)
|
||||
public int GetData (int x, int y, int z)
|
||||
{
|
||||
return _data[x, y, z];
|
||||
}
|
||||
|
||||
public void SetBlockData (int x, int y, int z, int data)
|
||||
public void SetData (int x, int y, int z, int data)
|
||||
{
|
||||
if (_data[x, y, z] != data) {
|
||||
_data[x, y, z] = (byte)data;
|
||||
|
@ -282,7 +282,7 @@ namespace Substrate
|
|||
}*/
|
||||
}
|
||||
|
||||
public int CountBlockData (int id, int data)
|
||||
public int CountByData (int id, int data)
|
||||
{
|
||||
int c = 0;
|
||||
for (int i = 0; i < _blocks.Length; i++) {
|
||||
|
@ -311,9 +311,9 @@ namespace Substrate
|
|||
|
||||
public void SetBlock (int x, int y, int z, ILitBlock block)
|
||||
{
|
||||
SetBlockID(x, y, z, block.ID);
|
||||
SetID(x, y, z, block.ID);
|
||||
SetBlockLight(x, y, z, block.BlockLight);
|
||||
SetBlockSkyLight(x, y, z, block.SkyLight);
|
||||
SetSkyLight(x, y, z, block.SkyLight);
|
||||
}
|
||||
|
||||
public int GetBlockLight (int x, int y, int z)
|
||||
|
@ -321,7 +321,7 @@ namespace Substrate
|
|||
return _blockLight[x, y, z];
|
||||
}
|
||||
|
||||
public int GetBlockSkyLight (int x, int y, int z)
|
||||
public int GetSkyLight (int x, int y, int z)
|
||||
{
|
||||
return _skyLight[x, y, z];
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ namespace Substrate
|
|||
}
|
||||
}
|
||||
|
||||
public void SetBlockSkyLight (int x, int y, int z, int light)
|
||||
public void SetSkyLight (int x, int y, int z, int light)
|
||||
{
|
||||
if (_skyLight[x, y, z] != light) {
|
||||
_skyLight[x, y, z] = (byte)light;
|
||||
|
@ -358,7 +358,7 @@ namespace Substrate
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
public void UpdateBlockSkyLight (int x, int y, int z)
|
||||
public void UpdateSkyLight (int x, int y, int z)
|
||||
{
|
||||
_lightManager.UpdateBlockSkyLight(x, y, z);
|
||||
_dirty = true;
|
||||
|
@ -370,7 +370,7 @@ namespace Substrate
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
public void ResetBlockSkyLight ()
|
||||
public void ResetSkyLight ()
|
||||
{
|
||||
_skyLight.Clear();
|
||||
_dirty = true;
|
||||
|
@ -382,7 +382,7 @@ namespace Substrate
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
public void RebuildBlockSkyLight ()
|
||||
public void RebuildSkyLight ()
|
||||
{
|
||||
_lightManager.RebuildBlockSkyLight();
|
||||
_dirty = true;
|
||||
|
@ -400,7 +400,7 @@ namespace Substrate
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
public void StitchBlockSkyLight ()
|
||||
public void StitchSkyLight ()
|
||||
{
|
||||
_lightManager.StitchBlockSkyLight();
|
||||
_dirty = true;
|
||||
|
@ -412,7 +412,7 @@ namespace Substrate
|
|||
_dirty = true;
|
||||
}
|
||||
|
||||
public void StitchBlockSkyLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge)
|
||||
public void StitchSkyLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge)
|
||||
{
|
||||
_lightManager.StitchBlockSkyLight(blockset, edge);
|
||||
_dirty = true;
|
||||
|
@ -435,7 +435,7 @@ namespace Substrate
|
|||
|
||||
public void SetBlock (int x, int y, int z, IPropertyBlock block)
|
||||
{
|
||||
SetBlockID(x, y, z, block.ID);
|
||||
SetID(x, y, z, block.ID);
|
||||
SetTileEntity(x, y, z, block.GetTileEntity().Copy());
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ namespace Substrate
|
|||
|
||||
public Block (IAlphaBlockCollection chunk, int lx, int ly, int lz)
|
||||
{
|
||||
_id = chunk.GetBlockID(lx, ly, lz);
|
||||
_data = chunk.GetBlockData(lx, ly, lz);
|
||||
_id = chunk.GetID(lx, ly, lz);
|
||||
_data = chunk.GetData(lx, ly, lz);
|
||||
_tileEntity = chunk.GetTileEntity(lx, ly, lz).Copy();
|
||||
}
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ namespace Substrate
|
|||
|
||||
void SetBlock (int x, int y, int z, IBlock block);
|
||||
|
||||
int GetBlockID (int x, int y, int z);
|
||||
void SetBlockID (int x, int y, int z, int id);
|
||||
int GetID (int x, int y, int z);
|
||||
void SetID (int x, int y, int z, int id);
|
||||
|
||||
BlockInfo GetBlockInfo (int x, int y, int z);
|
||||
BlockInfo GetInfo (int x, int y, int z);
|
||||
}
|
||||
|
||||
public interface IBoundedBlockCollection : IBlockCollection
|
||||
|
@ -55,7 +55,7 @@ namespace Substrate
|
|||
int YDim { get; }
|
||||
int ZDim { get; }
|
||||
|
||||
int CountBlockID (int id);
|
||||
int CountByID (int id);
|
||||
}
|
||||
|
||||
public interface IDataBlockCollection : IBlockCollection
|
||||
|
@ -65,13 +65,13 @@ namespace Substrate
|
|||
|
||||
void SetBlock (int x, int y, int z, IDataBlock block);
|
||||
|
||||
int GetBlockData (int x, int y, int z);
|
||||
void SetBlockData (int x, int y, int z, int data);
|
||||
int GetData (int x, int y, int z);
|
||||
void SetData (int x, int y, int z, int data);
|
||||
}
|
||||
|
||||
public interface IBoundedDataBlockCollection : IDataBlockCollection, IBoundedBlockCollection
|
||||
{
|
||||
int CountBlockData (int id, int data);
|
||||
int CountByData (int id, int data);
|
||||
}
|
||||
|
||||
public interface ILitBlockCollection : IBlockCollection
|
||||
|
@ -83,36 +83,36 @@ namespace Substrate
|
|||
|
||||
// Local Light
|
||||
int GetBlockLight (int x, int y, int z);
|
||||
int GetBlockSkyLight (int x, int y, int z);
|
||||
int GetSkyLight (int x, int y, int z);
|
||||
|
||||
void SetBlockLight (int x, int y, int z, int light);
|
||||
void SetBlockSkyLight (int x, int y, int z, int light);
|
||||
void SetSkyLight (int x, int y, int z, int light);
|
||||
|
||||
int GetHeight (int x, int z);
|
||||
void SetHeight (int x, int z, int height);
|
||||
|
||||
// Update and propagate light at a single block
|
||||
void UpdateBlockLight (int x, int y, int z);
|
||||
void UpdateBlockSkyLight (int x, int y, int z);
|
||||
void UpdateSkyLight (int x, int y, int z);
|
||||
}
|
||||
|
||||
public interface IBoundedLitBlockCollection : ILitBlockCollection, IBoundedBlockCollection
|
||||
{
|
||||
// Zero out light in entire collection
|
||||
void ResetBlockLight ();
|
||||
void ResetBlockSkyLight ();
|
||||
void ResetSkyLight ();
|
||||
|
||||
// Recalculate light in entire collection
|
||||
void RebuildBlockLight ();
|
||||
void RebuildBlockSkyLight ();
|
||||
void RebuildSkyLight ();
|
||||
void RebuildHeightMap ();
|
||||
|
||||
// Reconcile inconsistent lighting between the edges of two containers of same size
|
||||
void StitchBlockLight ();
|
||||
void StitchBlockSkyLight ();
|
||||
void StitchSkyLight ();
|
||||
|
||||
void StitchBlockLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge);
|
||||
void StitchBlockSkyLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge);
|
||||
void StitchSkyLight (IBoundedLitBlockCollection blockset, BlockCollectionEdge edge);
|
||||
}
|
||||
|
||||
public interface IPropertyBlockCollection : IBlockCollection
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace Substrate
|
|||
for (int x = 0; x < _blockset.XDim; x++) {
|
||||
for (int z = 0; z < _blockset.ZDim; z++) {
|
||||
for (int y = 0; y < _blockset.YDim; y++) {
|
||||
BlockInfo info = _blockset.GetBlockInfo(x, y, z);
|
||||
BlockInfo info = _blockset.GetInfo(x, y, z);
|
||||
if (info.Luminance > 0) {
|
||||
SpreadBlockLight(x, y, z);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace Substrate
|
|||
h = Math.Max(h, heightMap[xi, zi + 1]);
|
||||
|
||||
for (int y = h + 1; y < _blockset.YDim; y++) {
|
||||
_blockset.SetBlockSkyLight(x, y, z, BlockInfo.MAX_LUMINANCE);
|
||||
_blockset.SetSkyLight(x, y, z, BlockInfo.MAX_LUMINANCE);
|
||||
}
|
||||
|
||||
//QueueRelight(new BlockKey(x, h, z));
|
||||
|
@ -121,7 +121,7 @@ namespace Substrate
|
|||
for (int x = 0; x < _blockset.XDim; x++) {
|
||||
for (int z = 0; z < _blockset.ZDim; z++) {
|
||||
for (int y = _blockset.YDim - 1; y >= 0; y--) {
|
||||
BlockInfo info = _blockset.GetBlockInfo(x, y, z);
|
||||
BlockInfo info = _blockset.GetInfo(x, y, z);
|
||||
if (info.Opacity > BlockInfo.MIN_OPACITY || !info.TransmitsLight) {
|
||||
_blockset.SetHeight(x, z, y);
|
||||
break;
|
||||
|
@ -284,7 +284,7 @@ namespace Substrate
|
|||
int z = (k.z + _blockset.ZDim * 2) % _blockset.ZDim;
|
||||
|
||||
int lightval = cc.GetBlockLight(x, y, z);
|
||||
BlockInfo info = cc.GetBlockInfo(x, y, z);
|
||||
BlockInfo info = cc.GetInfo(x, y, z);
|
||||
|
||||
int light = Math.Max(info.Luminance, 0);
|
||||
light = Math.Max(light, lle - 1);
|
||||
|
@ -327,8 +327,8 @@ namespace Substrate
|
|||
int y = k.y;
|
||||
int z = (k.z + _blockset.ZDim) % _blockset.ZDim;
|
||||
|
||||
int lightval = cc.GetBlockSkyLight(x, y, z);
|
||||
BlockInfo info = cc.GetBlockInfo(x, y, z);
|
||||
int lightval = cc.GetSkyLight(x, y, z);
|
||||
BlockInfo info = cc.GetInfo(x, y, z);
|
||||
|
||||
int light = BlockInfo.MIN_LUMINANCE;
|
||||
|
||||
|
@ -356,7 +356,7 @@ namespace Substrate
|
|||
if (light != lightval) {
|
||||
//Console.WriteLine("Block SkyLight: ({0},{1},{2}) " + lightval + " -> " + light, k.x, k.y, k.z);
|
||||
|
||||
cc.SetBlockSkyLight(x, y, z, light);
|
||||
cc.SetSkyLight(x, y, z, light);
|
||||
|
||||
QueueRelight(new BlockKey(k.x - 1, k.y, k.z));
|
||||
QueueRelight(new BlockKey(k.x + 1, k.y, k.z));
|
||||
|
@ -371,7 +371,7 @@ namespace Substrate
|
|||
|
||||
private void SpreadBlockLight (int lx, int ly, int lz)
|
||||
{
|
||||
BlockInfo primary = _blockset.GetBlockInfo(lx, ly, lz);
|
||||
BlockInfo primary = _blockset.GetInfo(lx, ly, lz);
|
||||
int primaryLight = _blockset.GetBlockLight(lx, ly, lz);
|
||||
int priLum = Math.Max(primary.Luminance - primary.Opacity, 0);
|
||||
|
||||
|
@ -403,7 +403,7 @@ namespace Substrate
|
|||
int y = rec.y;
|
||||
int z = (rec.z + _blockset.ZDim) % _blockset.ZDim;
|
||||
|
||||
BlockInfo info = cc.GetBlockInfo(x, y, z);
|
||||
BlockInfo info = cc.GetInfo(x, y, z);
|
||||
int light = cc.GetBlockLight(x, y, z);
|
||||
|
||||
int dimStr = Math.Max(rec.str - info.Opacity, 0);
|
||||
|
@ -425,12 +425,12 @@ namespace Substrate
|
|||
|
||||
private void SpreadSkyLight (IBoundedLitBlockCollection[,] chunkMap, int[,] heightMap, int lx, int ly, int lz)
|
||||
{
|
||||
BlockInfo primary = _blockset.GetBlockInfo(lx, ly, lz);
|
||||
int primaryLight = _blockset.GetBlockSkyLight(lx, ly, lz);
|
||||
BlockInfo primary = _blockset.GetInfo(lx, ly, lz);
|
||||
int primaryLight = _blockset.GetSkyLight(lx, ly, lz);
|
||||
int priLum = Math.Max(BlockInfo.MAX_LUMINANCE - primary.Opacity, 0);
|
||||
|
||||
if (primaryLight < priLum) {
|
||||
_blockset.SetBlockSkyLight(lx, ly, lz, priLum);
|
||||
_blockset.SetSkyLight(lx, ly, lz, priLum);
|
||||
}
|
||||
|
||||
if (primaryLight > BlockInfo.MAX_LUMINANCE - 1 || !primary.TransmitsLight) {
|
||||
|
@ -480,13 +480,13 @@ namespace Substrate
|
|||
int y = rec.y;
|
||||
int z = zi % _blockset.ZDim;
|
||||
|
||||
BlockInfo info = cc.GetBlockInfo(x, y, z);
|
||||
int light = cc.GetBlockSkyLight(x, y, z);
|
||||
BlockInfo info = cc.GetInfo(x, y, z);
|
||||
int light = cc.GetSkyLight(x, y, z);
|
||||
|
||||
int dimStr = Math.Max(rec.str - info.Opacity, 0);
|
||||
|
||||
if (dimStr > light) {
|
||||
cc.SetBlockSkyLight(x, y, z, dimStr);
|
||||
cc.SetSkyLight(x, y, z, dimStr);
|
||||
|
||||
if (info.TransmitsLight) {
|
||||
/*spread.Enqueue(new LightRecord(rec.x - 1, rec.y, rec.z, dimStr - 1));
|
||||
|
@ -604,7 +604,7 @@ namespace Substrate
|
|||
x = (x + _blockset.XDim * 2) % _blockset.XDim;
|
||||
z = (z + _blockset.ZDim * 2) % _blockset.ZDim;
|
||||
|
||||
BlockInfo info = src.GetBlockInfo(x, y, z);
|
||||
BlockInfo info = src.GetInfo(x, y, z);
|
||||
if (!info.TransmitsLight) {
|
||||
return info.Luminance;
|
||||
}
|
||||
|
@ -628,12 +628,12 @@ namespace Substrate
|
|||
x = (x + _blockset.XDim * 2) % _blockset.XDim;
|
||||
z = (z + _blockset.ZDim * 2) % _blockset.ZDim;
|
||||
|
||||
BlockInfo info = src.GetBlockInfo(x, y, z);
|
||||
BlockInfo info = src.GetInfo(x, y, z);
|
||||
if (!info.TransmitsLight) {
|
||||
return BlockInfo.MIN_LUMINANCE;
|
||||
}
|
||||
|
||||
int light = src.GetBlockSkyLight(x, y, z);
|
||||
int light = src.GetSkyLight(x, y, z);
|
||||
|
||||
return light;
|
||||
}
|
||||
|
@ -656,8 +656,8 @@ namespace Substrate
|
|||
{
|
||||
int light1 = _blockset.GetBlockLight(x1, y1, z1);
|
||||
int light2 = chunk.GetBlockLight(x2, y2, z2);
|
||||
int lum1 = _blockset.GetBlockInfo(x1, y1, z1).Luminance;
|
||||
int lum2 = chunk.GetBlockInfo(x2, y2, z2).Luminance;
|
||||
int lum1 = _blockset.GetInfo(x1, y1, z1).Luminance;
|
||||
int lum2 = chunk.GetInfo(x2, y2, z2).Luminance;
|
||||
|
||||
int v1 = Math.Max(light1, lum1);
|
||||
int v2 = Math.Max(light2, lum2);
|
||||
|
@ -668,8 +668,8 @@ namespace Substrate
|
|||
|
||||
private void TestSkyLight (IBoundedLitBlockCollection chunk, int x1, int y1, int z1, int x2, int y2, int z2)
|
||||
{
|
||||
int light1 = _blockset.GetBlockSkyLight(x1, y1, z1);
|
||||
int light2 = chunk.GetBlockSkyLight(x2, y2, z2);
|
||||
int light1 = _blockset.GetSkyLight(x1, y1, z1);
|
||||
int light2 = chunk.GetSkyLight(x2, y2, z2);
|
||||
|
||||
if (Math.Abs(light1 - light2) > 1) {
|
||||
QueueRelight(new BlockKey(x1, y1, z1));
|
||||
|
|
|
@ -129,27 +129,27 @@ namespace Substrate
|
|||
_cache.Blocks.SetBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
public BlockInfo GetBlockInfo (int x, int y, int z)
|
||||
public BlockInfo GetInfo (int x, int y, int z)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null || !Check(x, y, z)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return _cache.Blocks.GetBlockInfo(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
return _cache.Blocks.GetInfo(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
}
|
||||
|
||||
public int GetBlockID (int x, int y, int z)
|
||||
public int GetID (int x, int y, int z)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _cache.Blocks.GetBlockID(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
return _cache.Blocks.GetID(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
}
|
||||
|
||||
public void SetBlockID (int x, int y, int z, int id)
|
||||
public void SetID (int x, int y, int z, int id)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null || !Check(x, y, z)) {
|
||||
|
@ -159,7 +159,7 @@ namespace Substrate
|
|||
bool autolight = _cache.Blocks.AutoLight;
|
||||
_cache.Blocks.AutoLight = _autoLight;
|
||||
|
||||
_cache.Blocks.SetBlockID(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, id);
|
||||
_cache.Blocks.SetID(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, id);
|
||||
|
||||
_cache.Blocks.AutoLight = autolight;
|
||||
}
|
||||
|
@ -184,24 +184,24 @@ namespace Substrate
|
|||
_cache.Blocks.SetBlock(x, y, z, block);
|
||||
}
|
||||
|
||||
public int GetBlockData (int x, int y, int z)
|
||||
public int GetData (int x, int y, int z)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _cache.Blocks.GetBlockData(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
return _cache.Blocks.GetData(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
}
|
||||
|
||||
public void SetBlockData (int x, int y, int z, int data)
|
||||
public void SetData (int x, int y, int z, int data)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null || !Check(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_cache.Blocks.SetBlockData(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, data);
|
||||
_cache.Blocks.SetData(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, data);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -234,14 +234,14 @@ namespace Substrate
|
|||
return _cache.Blocks.GetBlockLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
}
|
||||
|
||||
public int GetBlockSkyLight (int x, int y, int z)
|
||||
public int GetSkyLight (int x, int y, int z)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return _cache.Blocks.GetBlockSkyLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
return _cache.Blocks.GetSkyLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
}
|
||||
|
||||
public void SetBlockLight (int x, int y, int z, int light)
|
||||
|
@ -254,14 +254,14 @@ namespace Substrate
|
|||
_cache.Blocks.SetBlockLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, light);
|
||||
}
|
||||
|
||||
public void SetBlockSkyLight (int x, int y, int z, int light)
|
||||
public void SetSkyLight (int x, int y, int z, int light)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null || !Check(x, y, z)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_cache.Blocks.SetBlockSkyLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, light);
|
||||
_cache.Blocks.SetSkyLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask, light);
|
||||
}
|
||||
|
||||
public int GetHeight (int x, int z)
|
||||
|
@ -294,7 +294,7 @@ namespace Substrate
|
|||
_cache.Blocks.UpdateBlockLight(x & _chunkXMask, y & _chunkYMask, z & _chunkZMask);
|
||||
}
|
||||
|
||||
public void UpdateBlockSkyLight (int x, int y, int z)
|
||||
public void UpdateSkyLight (int x, int y, int z)
|
||||
{
|
||||
_cache = GetChunk(x, y, z);
|
||||
if (_cache == null || !Check(x, y, z)) {
|
||||
|
|
|
@ -56,19 +56,19 @@ namespace Substrate
|
|||
|
||||
public BlockInfo Info
|
||||
{
|
||||
get { return BlockInfo.BlockTable[_container.GetBlockID(_x, _y, _z)]; }
|
||||
get { return BlockInfo.BlockTable[_container.GetID(_x, _y, _z)]; }
|
||||
}
|
||||
|
||||
public int ID
|
||||
{
|
||||
get { return _container.GetBlockID(_x, _y, _z); }
|
||||
set { _container.SetBlockID(_x, _y, _z, value); }
|
||||
get { return _container.GetID(_x, _y, _z); }
|
||||
set { _container.SetID(_x, _y, _z, value); }
|
||||
}
|
||||
|
||||
public int Data
|
||||
{
|
||||
get { return _container.GetBlockData(_x, _y, _z); }
|
||||
set { _container.SetBlockData(_x, _y, _z, value); }
|
||||
get { return _container.GetData(_x, _y, _z); }
|
||||
set { _container.SetData(_x, _y, _z, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -84,8 +84,8 @@ namespace Substrate
|
|||
|
||||
public int SkyLight
|
||||
{
|
||||
get { return _container.GetBlockSkyLight(_x, _y, _z); }
|
||||
set { _container.SetBlockSkyLight(_x, _y, _z, value); }
|
||||
get { return _container.GetSkyLight(_x, _y, _z); }
|
||||
set { _container.SetSkyLight(_x, _y, _z, value); }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -196,37 +196,37 @@ namespace Substrate
|
|||
|
||||
foreach (ChunkRef chunk in dirty.Values) {
|
||||
chunk.Blocks.ResetBlockLight();
|
||||
chunk.Blocks.ResetBlockSkyLight();
|
||||
chunk.Blocks.ResetSkyLight();
|
||||
}
|
||||
|
||||
foreach (ChunkRef chunk in dirty.Values) {
|
||||
chunk.Blocks.RebuildBlockLight();
|
||||
chunk.Blocks.RebuildBlockSkyLight();
|
||||
chunk.Blocks.RebuildSkyLight();
|
||||
}
|
||||
|
||||
foreach (ChunkRef chunk in dirty.Values) {
|
||||
if (!dirty.ContainsKey(new ChunkKey(chunk.X, chunk.Z - 1))) {
|
||||
ChunkRef east = chunk.GetEastNeighbor();
|
||||
chunk.Blocks.StitchBlockLight(east.Blocks, BlockCollectionEdge.EAST);
|
||||
chunk.Blocks.StitchBlockSkyLight(east.Blocks, BlockCollectionEdge.EAST);
|
||||
chunk.Blocks.StitchSkyLight(east.Blocks, BlockCollectionEdge.EAST);
|
||||
}
|
||||
|
||||
if (!dirty.ContainsKey(new ChunkKey(chunk.X, chunk.Z + 1))) {
|
||||
ChunkRef west = chunk.GetWestNeighbor();
|
||||
chunk.Blocks.StitchBlockLight(west.Blocks, BlockCollectionEdge.WEST);
|
||||
chunk.Blocks.StitchBlockSkyLight(west.Blocks, BlockCollectionEdge.WEST);
|
||||
chunk.Blocks.StitchSkyLight(west.Blocks, BlockCollectionEdge.WEST);
|
||||
}
|
||||
|
||||
if (!dirty.ContainsKey(new ChunkKey(chunk.X - 1, chunk.Z))) {
|
||||
ChunkRef north = chunk.GetNorthNeighbor();
|
||||
chunk.Blocks.StitchBlockLight(north.Blocks, BlockCollectionEdge.NORTH);
|
||||
chunk.Blocks.StitchBlockSkyLight(north.Blocks, BlockCollectionEdge.NORTH);
|
||||
chunk.Blocks.StitchSkyLight(north.Blocks, BlockCollectionEdge.NORTH);
|
||||
}
|
||||
|
||||
if (!dirty.ContainsKey(new ChunkKey(chunk.X + 1, chunk.Z))) {
|
||||
ChunkRef south = chunk.GetSouthNeighbor();
|
||||
chunk.Blocks.StitchBlockLight(south.Blocks, BlockCollectionEdge.SOUTH);
|
||||
chunk.Blocks.StitchBlockSkyLight(south.Blocks, BlockCollectionEdge.SOUTH);
|
||||
chunk.Blocks.StitchSkyLight(south.Blocks, BlockCollectionEdge.SOUTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue