mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-04 00:46:08 +00:00
Revert "Fix mantle "
This reverts commit 59399124fa168566b4a2113df6a8678db4486824.
This commit is contained in:
parent
4b991ab67a
commit
72b4c9c6ab
@ -80,7 +80,7 @@ public class Mantle {
|
|||||||
unload = new KSet<>();
|
unload = new KSet<>();
|
||||||
loadedRegions = new KMap<>();
|
loadedRegions = new KMap<>();
|
||||||
lastUse = new KMap<>();
|
lastUse = new KMap<>();
|
||||||
ioBurst = new MultiBurst("Iris Mantle[" + dataFolder.hashCode() + "]", Thread.MIN_PRIORITY, Runtime.getRuntime().availableProcessors() / 2);
|
ioBurst = MultiBurst.burst;
|
||||||
Iris.debug("Opened The Mantle " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
Iris.debug("Opened The Mantle " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,6 +126,19 @@ public class Mantle {
|
|||||||
get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).flag(flag, flagged);
|
get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).flag(flag, flagged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check very quickly if a tectonic plate exists via cached or the file system
|
||||||
|
* @param x the x region coordinate
|
||||||
|
* @param z the z region coordinate
|
||||||
|
* @return true if it exists
|
||||||
|
*/
|
||||||
|
@RegionCoordinates
|
||||||
|
public boolean hasTectonicPlate(int x, int z)
|
||||||
|
{
|
||||||
|
Long k = key(x, z);
|
||||||
|
return loadedRegions.containsKey(k) || fileForRegion(dataFolder, k).exists();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate data in a chunk
|
* Iterate data in a chunk
|
||||||
* @param x the chunk x
|
* @param x the chunk x
|
||||||
@ -137,6 +150,11 @@ public class Mantle {
|
|||||||
*/
|
*/
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator, MantleFlag... requiredFlags) {
|
public <T> void iterateChunk(int x, int z, Class<T> type, Consumer4<Integer, Integer, Integer, T> iterator, MantleFlag... requiredFlags) {
|
||||||
|
if(!hasTectonicPlate(x >> 5, z >> 5))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
for (MantleFlag i : requiredFlags) {
|
for (MantleFlag i : requiredFlags) {
|
||||||
if (!hasFlag(x, z, i)) {
|
if (!hasFlag(x, z, i)) {
|
||||||
return;
|
return;
|
||||||
@ -155,6 +173,11 @@ public class Mantle {
|
|||||||
*/
|
*/
|
||||||
@ChunkCoordinates
|
@ChunkCoordinates
|
||||||
public boolean hasFlag(int x, int z, MantleFlag flag) {
|
public boolean hasFlag(int x, int z, MantleFlag flag) {
|
||||||
|
if(!hasTectonicPlate(x >> 5, z >> 5))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).isFlagged(flag);
|
return get(x >> 5, z >> 5).getOrCreate(x & 31, z & 31).isFlagged(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +234,12 @@ public class Mantle {
|
|||||||
throw new RuntimeException("The Mantle is closed");
|
throw new RuntimeException("The Mantle is closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (y < 0) {
|
if(!hasTectonicPlate(x >> 5, z >> 5))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (y < 0 || y >= worldHeight) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +291,6 @@ public class Mantle {
|
|||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ioBurst.shutdownNow();
|
|
||||||
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
Iris.debug("The Mantle has Closed " + C.DARK_AQUA + dataFolder.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user