2011-04-06 04:43:54 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2011-04-06 21:20:35 +00:00
|
|
|
|
namespace Substrate
|
2011-04-06 04:43:54 +00:00
|
|
|
|
{
|
|
|
|
|
public struct BlockKey : IEquatable<BlockKey>
|
|
|
|
|
{
|
2011-04-11 06:13:33 +00:00
|
|
|
|
public readonly int x;
|
|
|
|
|
public readonly int y;
|
|
|
|
|
public readonly int z;
|
2011-04-06 04:43:54 +00:00
|
|
|
|
|
|
|
|
|
public BlockKey (int _x, int _y, int _z)
|
|
|
|
|
{
|
|
|
|
|
x = _x;
|
|
|
|
|
y = _y;
|
|
|
|
|
z = _z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Equals (BlockKey bk)
|
|
|
|
|
{
|
|
|
|
|
return this.x == bk.x && this.y == bk.y && this.z == bk.z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Equals (Object o)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
return this == (BlockKey)o;
|
|
|
|
|
}
|
|
|
|
|
catch {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode ()
|
|
|
|
|
{
|
|
|
|
|
int hash = 23;
|
|
|
|
|
hash = hash * 37 + x;
|
|
|
|
|
hash = hash * 37 + y;
|
|
|
|
|
hash = hash * 37 + z;
|
|
|
|
|
return hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator == (BlockKey k1, BlockKey k2)
|
|
|
|
|
{
|
|
|
|
|
return k1.x == k2.x && k1.y == k2.y && k1.z == k2.z;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool operator != (BlockKey k1, BlockKey k2)
|
|
|
|
|
{
|
|
|
|
|
return k1.x != k2.x || k1.y != k2.y || k1.z != k2.z;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|