DataStore#getChunkHash is publicly accessible (#943)
This commit is contained in:
parent
40ca1d756e
commit
ee1a5c567b
|
|
@ -976,20 +976,6 @@ public class Claim
|
||||||
|
|
||||||
ArrayList<Long> getChunkHashes()
|
ArrayList<Long> getChunkHashes()
|
||||||
{
|
{
|
||||||
ArrayList<Long> hashes = new ArrayList<Long>();
|
return DataStore.getChunkHashes(this);
|
||||||
int smallX = this.getLesserBoundaryCorner().getBlockX() >> 4;
|
|
||||||
int smallZ = this.getLesserBoundaryCorner().getBlockZ() >> 4;
|
|
||||||
int largeX = this.getGreaterBoundaryCorner().getBlockX() >> 4;
|
|
||||||
int largeZ = this.getGreaterBoundaryCorner().getBlockZ() >> 4;
|
|
||||||
|
|
||||||
for (int x = smallX; x <= largeX; x++)
|
|
||||||
{
|
|
||||||
for (int z = smallZ; z <= largeZ; z++)
|
|
||||||
{
|
|
||||||
hashes.add(DataStore.getChunkHash(x, z));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return hashes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -785,17 +785,39 @@ public abstract class DataStore
|
||||||
}
|
}
|
||||||
|
|
||||||
//gets an almost-unique, persistent identifier for a chunk
|
//gets an almost-unique, persistent identifier for a chunk
|
||||||
static Long getChunkHash(long chunkx, long chunkz)
|
public static Long getChunkHash(long chunkx, long chunkz)
|
||||||
{
|
{
|
||||||
return (chunkz ^ (chunkx << 32));
|
return (chunkz ^ (chunkx << 32));
|
||||||
}
|
}
|
||||||
|
|
||||||
//gets an almost-unique, persistent identifier for a chunk
|
//gets an almost-unique, persistent identifier for a chunk
|
||||||
static Long getChunkHash(Location location)
|
public static Long getChunkHash(Location location)
|
||||||
{
|
{
|
||||||
return getChunkHash(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
return getChunkHash(location.getBlockX() >> 4, location.getBlockZ() >> 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Long> getChunkHashes(Claim claim) {
|
||||||
|
return getChunkHashes(claim.getLesserBoundaryCorner(), claim.getGreaterBoundaryCorner());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ArrayList<Long> getChunkHashes(Location min, Location max) {
|
||||||
|
ArrayList<Long> hashes = new ArrayList<>();
|
||||||
|
int smallX = min.getBlockX() >> 4;
|
||||||
|
int smallZ = min.getBlockZ() >> 4;
|
||||||
|
int largeX = max.getBlockX() >> 4;
|
||||||
|
int largeZ = max.getBlockZ() >> 4;
|
||||||
|
|
||||||
|
for (int x = smallX; x <= largeX; x++)
|
||||||
|
{
|
||||||
|
for (int z = smallZ; z <= largeZ; z++)
|
||||||
|
{
|
||||||
|
hashes.add(getChunkHash(x, z));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return hashes;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Creates a claim and flags it as being new....throwing a create claim event;
|
* Creates a claim and flags it as being new....throwing a create claim event;
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user