forked from mirrors/NBTExplorer
Changing ID references from BlockType to BlockInfo
This commit is contained in:
parent
3b781d0a02
commit
943b474c95
2 changed files with 23 additions and 23 deletions
|
@ -695,11 +695,11 @@ namespace Substrate
|
||||||
|
|
||||||
int blocktype = _blocks[x, y, z];
|
int blocktype = _blocks[x, y, z];
|
||||||
|
|
||||||
if (blocktype == BlockType.WATER || blocktype == BlockType.STATIONARY_WATER) {
|
if (blocktype == BlockInfo.Water.ID || blocktype == BlockInfo.StationaryWater.ID) {
|
||||||
_fluidManager.UpdateWater(x, y, z);
|
_fluidManager.UpdateWater(x, y, z);
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
else if (blocktype == BlockType.LAVA || blocktype == BlockType.STATIONARY_LAVA) {
|
else if (blocktype == BlockInfo.Lava.ID || blocktype == BlockInfo.StationaryLava.ID) {
|
||||||
_fluidManager.UpdateLava(x, y, z);
|
_fluidManager.UpdateLava(x, y, z);
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,12 +65,12 @@ namespace Substrate.Core
|
||||||
public void ResetWater (ByteArray blocks, NibbleArray data)
|
public void ResetWater (ByteArray blocks, NibbleArray data)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < blocks.Length; i++) {
|
for (int i = 0; i < blocks.Length; i++) {
|
||||||
if ((blocks[i] == BlockType.STATIONARY_WATER || blocks[i] == BlockType.WATER) && data[i] != 0) {
|
if ((blocks[i] == BlockInfo.StationaryWater.ID || blocks[i] == BlockInfo.Water.ID) && data[i] != 0) {
|
||||||
blocks[i] = BlockType.AIR;
|
blocks[i] = (byte)BlockInfo.Air.ID;
|
||||||
data[i] = 0;
|
data[i] = 0;
|
||||||
}
|
}
|
||||||
else if (blocks[i] == BlockType.WATER) {
|
else if (blocks[i] == BlockInfo.Water.ID) {
|
||||||
blocks[i] = BlockType.STATIONARY_WATER;
|
blocks[i] = (byte)BlockInfo.StationaryWater.ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,12 +78,12 @@ namespace Substrate.Core
|
||||||
public void ResetLava (ByteArray blocks, NibbleArray data)
|
public void ResetLava (ByteArray blocks, NibbleArray data)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < blocks.Length; i++) {
|
for (int i = 0; i < blocks.Length; i++) {
|
||||||
if ((blocks[i] == BlockType.STATIONARY_LAVA || blocks[i] == BlockType.LAVA) && data[i] != 0) {
|
if ((blocks[i] == BlockInfo.StationaryLava.ID || blocks[i] == BlockInfo.Lava.ID) && data[i] != 0) {
|
||||||
blocks[i] = BlockType.AIR;
|
blocks[i] = (byte)BlockInfo.Air.ID;
|
||||||
data[i] = 0;
|
data[i] = 0;
|
||||||
}
|
}
|
||||||
else if (blocks[i] == BlockType.LAVA) {
|
else if (blocks[i] == BlockInfo.Lava.ID) {
|
||||||
blocks[i] = BlockType.STATIONARY_LAVA;
|
blocks[i] = (byte)BlockInfo.StationaryWater.ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ namespace Substrate.Core
|
||||||
for (int z = 0; z < zdim; z++) {
|
for (int z = 0; z < zdim; z++) {
|
||||||
for (int y = 0; y < ydim; y++) {
|
for (int y = 0; y < ydim; y++) {
|
||||||
BlockInfo info = _blockset.GetInfo(x, y, z);
|
BlockInfo info = _blockset.GetInfo(x, y, z);
|
||||||
if (info.ID == BlockType.STATIONARY_WATER && _blockset.GetData(x, y, z) == 0) {
|
if (info.ID == BlockInfo.StationaryWater.ID && _blockset.GetData(x, y, z) == 0) {
|
||||||
buildQueue.Add(new BlockKey(x, y, z));
|
buildQueue.Add(new BlockKey(x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ namespace Substrate.Core
|
||||||
for (int z = 0; z < zdim; z++) {
|
for (int z = 0; z < zdim; z++) {
|
||||||
for (int y = 0; y < ydim; y++) {
|
for (int y = 0; y < ydim; y++) {
|
||||||
BlockInfo info = _blockset.GetInfo(x, y, z);
|
BlockInfo info = _blockset.GetInfo(x, y, z);
|
||||||
if (info.ID == BlockType.STATIONARY_LAVA && _blockset.GetData(x, y, z) == 0) {
|
if (info.ID == BlockInfo.StationaryLava.ID && _blockset.GetData(x, y, z) == 0) {
|
||||||
buildQueue.Add(new BlockKey(x, y, z));
|
buildQueue.Add(new BlockKey(x, y, z));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -407,7 +407,7 @@ namespace Substrate.Core
|
||||||
|
|
||||||
BlockCoord tile = TranslateCoord(key.x, key.y, key.z);
|
BlockCoord tile = TranslateCoord(key.x, key.y, key.z);
|
||||||
BlockInfo tileInfo = tile.chunk.GetInfo(tile.lx, tile.ly, tile.lz);
|
BlockInfo tileInfo = tile.chunk.GetInfo(tile.lx, tile.ly, tile.lz);
|
||||||
if (tileInfo.ID == BlockType.STATIONARY_WATER || tileInfo.ID == BlockType.WATER) {
|
if (tileInfo.ID == BlockInfo.StationaryWater.ID || tileInfo.ID == BlockInfo.Water.ID) {
|
||||||
curflow = tile.chunk.GetData(tile.lx, tile.ly, tile.lz);
|
curflow = tile.chunk.GetData(tile.lx, tile.ly, tile.lz);
|
||||||
}
|
}
|
||||||
else if (tileInfo.BlocksFluid) {
|
else if (tileInfo.BlocksFluid) {
|
||||||
|
@ -443,14 +443,14 @@ namespace Substrate.Core
|
||||||
// Update flow, add or remove water tile as necessary
|
// Update flow, add or remove water tile as necessary
|
||||||
if (newflow < 16 && curflow == 16) {
|
if (newflow < 16 && curflow == 16) {
|
||||||
// If we're overwriting lava, replace with appropriate stone type and abort propagation
|
// If we're overwriting lava, replace with appropriate stone type and abort propagation
|
||||||
if (tileInfo.ID == BlockType.STATIONARY_LAVA || tileInfo.ID == BlockType.LAVA) {
|
if (tileInfo.ID == BlockInfo.StationaryLava.ID || tileInfo.ID == BlockInfo.Lava.ID) {
|
||||||
if ((newflow & (int)LiquidState.FALLING) != 0) {
|
if ((newflow & (int)LiquidState.FALLING) != 0) {
|
||||||
int odata = tile.chunk.GetData(tile.lx, tile.ly, tile.lz);
|
int odata = tile.chunk.GetData(tile.lx, tile.ly, tile.lz);
|
||||||
if (odata == 0) {
|
if (odata == 0) {
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.OBSIDIAN);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.Obsidian.ID);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.COBBLESTONE);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.Cobblestone.ID);
|
||||||
}
|
}
|
||||||
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
||||||
continue;
|
continue;
|
||||||
|
@ -458,11 +458,11 @@ namespace Substrate.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise replace the tile with our water flow
|
// Otherwise replace the tile with our water flow
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.STATIONARY_WATER);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.StationaryWater.ID);
|
||||||
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, newflow);
|
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, newflow);
|
||||||
}
|
}
|
||||||
else if (newflow == 16) {
|
else if (newflow == 16) {
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.AIR);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.Air.ID);
|
||||||
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -498,7 +498,7 @@ namespace Substrate.Core
|
||||||
|
|
||||||
BlockCoord tile = TranslateCoord(key.x, key.y, key.z);
|
BlockCoord tile = TranslateCoord(key.x, key.y, key.z);
|
||||||
BlockInfo tileInfo = tile.chunk.GetInfo(tile.lx, tile.ly, tile.lz);
|
BlockInfo tileInfo = tile.chunk.GetInfo(tile.lx, tile.ly, tile.lz);
|
||||||
if (tileInfo.ID == BlockType.STATIONARY_LAVA || tileInfo.ID == BlockType.LAVA) {
|
if (tileInfo.ID == BlockInfo.StationaryLava.ID || tileInfo.ID == BlockInfo.Lava.ID) {
|
||||||
curflow = tile.chunk.GetData(tile.lx, tile.ly, tile.lz);
|
curflow = tile.chunk.GetData(tile.lx, tile.ly, tile.lz);
|
||||||
}
|
}
|
||||||
else if (tileInfo.BlocksFluid) {
|
else if (tileInfo.BlocksFluid) {
|
||||||
|
@ -534,19 +534,19 @@ namespace Substrate.Core
|
||||||
// Update flow, add or remove lava tile as necessary
|
// Update flow, add or remove lava tile as necessary
|
||||||
if (newflow < 16 && curflow == 16) {
|
if (newflow < 16 && curflow == 16) {
|
||||||
// If we're overwriting water, replace with appropriate stone type and abort propagation
|
// If we're overwriting water, replace with appropriate stone type and abort propagation
|
||||||
if (tileInfo.ID == BlockType.STATIONARY_WATER || tileInfo.ID == BlockType.WATER) {
|
if (tileInfo.ID == BlockInfo.StationaryWater.ID || tileInfo.ID == BlockInfo.Water.ID) {
|
||||||
if ((newflow & (int)LiquidState.FALLING) == 0) {
|
if ((newflow & (int)LiquidState.FALLING) == 0) {
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.COBBLESTONE);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.Cobblestone.ID);
|
||||||
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.STATIONARY_LAVA);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.StationaryLava.ID);
|
||||||
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, newflow);
|
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, newflow);
|
||||||
}
|
}
|
||||||
else if (newflow == 16) {
|
else if (newflow == 16) {
|
||||||
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockType.AIR);
|
tile.chunk.SetID(tile.lx, tile.ly, tile.lz, BlockInfo.Air.ID);
|
||||||
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
tile.chunk.SetData(tile.lx, tile.ly, tile.lz, 0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue