forked from mirrors/NBTExplorer
54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace NBToolkit.Map
|
|
{
|
|
public struct BlockKey : IEquatable<BlockKey>
|
|
{
|
|
readonly int x;
|
|
readonly int y;
|
|
readonly int z;
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|