mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-16 21:30:04 +00:00
Idea Nitpick ""Optimizations""
This commit is contained in:
@@ -42,8 +42,8 @@ public class AtomicRegionData
|
||||
|
||||
for(String i : tags.keySet())
|
||||
{
|
||||
int x = Integer.valueOf(i.split("\\Q.\\E")[0]);
|
||||
int z = Integer.valueOf(i.split("\\Q.\\E")[1]);
|
||||
int x = Integer.parseInt(i.split("\\Q.\\E")[0]);
|
||||
int z = Integer.parseInt(i.split("\\Q.\\E")[1]);
|
||||
tag[(z << 5) | x] = tags.get(i);
|
||||
}
|
||||
|
||||
@@ -104,8 +104,7 @@ public class AtomicRegionData
|
||||
tag[(rz << 5) | rx] = new ByteArrayTag(rx + "." + rz, b);
|
||||
}
|
||||
|
||||
public AtomicSliverMap get(int rx, int rz) throws IOException
|
||||
{
|
||||
public AtomicSliverMap get(int rx, int rz) {
|
||||
AtomicSliverMap data = new AtomicSliverMap();
|
||||
|
||||
if(!contains(rx, rz))
|
||||
|
||||
@@ -53,7 +53,7 @@ public class AtomicSliver
|
||||
|
||||
public Material getTypeSafe(int h)
|
||||
{
|
||||
return get(h > 255 ? 255 : h < 0 ? 0 : h).getMaterial();
|
||||
return get(h > 255 ? 255 : Math.max(h, 0)).getMaterial();
|
||||
}
|
||||
|
||||
public KList<Byte> getUpdatables()
|
||||
@@ -125,7 +125,7 @@ public class AtomicSliver
|
||||
setSilently(h, d);
|
||||
modified = true;
|
||||
lock.lock();
|
||||
highestBlock = h > highestBlock ? h : highestBlock;
|
||||
highestBlock = Math.max(h, highestBlock);
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ public class AtomicSliverMap
|
||||
return null;
|
||||
}
|
||||
|
||||
return new IrisStructureResult(s.getTiles().get(Integer.valueOf(a[1])), s);
|
||||
return new IrisStructureResult(s.getTiles().get(Integer.parseInt(a[1])), s);
|
||||
}
|
||||
|
||||
public void write(OutputStream out) throws IOException
|
||||
|
||||
@@ -15,14 +15,14 @@ import com.volmit.iris.util.M;
|
||||
|
||||
public class AtomicWorldData
|
||||
{
|
||||
private TerrainTarget world;
|
||||
private KMap<ChunkPosition, AtomicSliverMap> loadedChunks;
|
||||
private KMap<ChunkPosition, AtomicRegionData> loadedSections;
|
||||
private KMap<ChunkPosition, Long> lastRegion;
|
||||
private KMap<ChunkPosition, Long> lastChunk;
|
||||
private KList<ChunkPosition> unloadRegions;
|
||||
private KList<ChunkPosition> unloadChunks;
|
||||
private IrisLock lock = new IrisLock("ULLock");
|
||||
private final TerrainTarget world;
|
||||
private final KMap<ChunkPosition, AtomicSliverMap> loadedChunks;
|
||||
private final KMap<ChunkPosition, AtomicRegionData> loadedSections;
|
||||
private final KMap<ChunkPosition, Long> lastRegion;
|
||||
private final KMap<ChunkPosition, Long> lastChunk;
|
||||
private final KList<ChunkPosition> unloadRegions;
|
||||
private final KList<ChunkPosition> unloadChunks;
|
||||
private final IrisLock lock = new IrisLock("ULLock");
|
||||
private long last = M.ms();
|
||||
|
||||
public AtomicWorldData(TerrainTarget world)
|
||||
@@ -34,6 +34,7 @@ public class AtomicWorldData
|
||||
lastChunk = new KMap<>();
|
||||
unloadRegions = new KList<>();
|
||||
unloadChunks = new KList<>();
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
getSubregionFolder().mkdirs();
|
||||
}
|
||||
|
||||
@@ -83,6 +84,7 @@ public class AtomicWorldData
|
||||
public void deleteSection(int x, int z) throws IOException
|
||||
{
|
||||
unloadSection(x, z, false);
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
getSubregionFile(x, z).delete();
|
||||
}
|
||||
|
||||
@@ -263,7 +265,7 @@ public class AtomicWorldData
|
||||
return loadedChunks;
|
||||
}
|
||||
|
||||
public void clean(int j)
|
||||
public void clean()
|
||||
{
|
||||
lock.lock();
|
||||
if(M.ms() - last < getUnloadBatchSpeed())
|
||||
|
||||
@@ -5,8 +5,8 @@ import com.volmit.iris.util.KMap;
|
||||
|
||||
public class MasterLock
|
||||
{
|
||||
private KMap<String, IrisLock> locks;
|
||||
private IrisLock lock;
|
||||
private final KMap<String, IrisLock> locks;
|
||||
private final IrisLock lock;
|
||||
private boolean enabled;
|
||||
|
||||
public MasterLock()
|
||||
|
||||
Reference in New Issue
Block a user