Skip to content

Commit

Permalink
Implement getBlockCacheNode correctly (no interface).
Browse files Browse the repository at this point in the history
  • Loading branch information
asofold committed Nov 20, 2016
1 parent cc538ee commit 67a500e
Showing 1 changed file with 23 additions and 7 deletions.
Expand Up @@ -320,16 +320,32 @@ public double[] getBounds(final int x, final int y, final int z) {
return nBounds;
}

// TODO: Interface / Override annotation.
/**
* Get the internally stored BlockCacheNode instance for the given
* coordinates. Creation/updating is controlled with forceSetAll.
*
* @param x
* @param y
* @param z
* @param forceSetAll
* @return If forceSetAll is true, a node will always be returned with all
* properties set. If forceSetAll is false, null might be returned,
* if no node is present for the given coordinates.
*/
public BlockCacheNode getBlockCacheNode(int x, int y, int z, boolean forceSetAll) {
final BlockCacheNode node = getOrCreateNode(x, y, z);
if (!node.isDataFetched()) {
node.setData(fetchData(x, y, z));
if (forceSetAll) {
final BlockCacheNode node = getOrCreateNode(x, y, z);
if (!node.isDataFetched()) {
node.setData(fetchData(x, y, z));
}
if (!node.isBoundsFetched()) {
node.setBounds(fetchBounds(x, y, z));
}
return node;
}
if (!node.isBoundsFetched()) {
node.setBounds(fetchBounds(x, y, z));
else {
return nodeMap.get(x, y, z);
}
return node;
}

/**
Expand Down

0 comments on commit 67a500e

Please sign in to comment.