mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-04-21 07:30:30 +00:00
No Caching
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package com.volmit.iris.gen.atomics;
|
||||
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
|
||||
public class AtomicBiomeMap extends AtomicObjectMap<IrisBiome> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.volmit.iris.gen.atomics;
|
||||
|
||||
import com.google.common.util.concurrent.AtomicDoubleArray;
|
||||
|
||||
public class AtomicDoubleMap {
|
||||
private final AtomicDoubleArray data;
|
||||
|
||||
public AtomicDoubleMap() {
|
||||
data = new AtomicDoubleArray(256);
|
||||
}
|
||||
|
||||
public double get(int x, int z) {
|
||||
return data.get((z << 4) | x);
|
||||
}
|
||||
|
||||
public int getInt(int x, int z) {
|
||||
return (int) Math.round(get(x, z));
|
||||
}
|
||||
|
||||
public void set(int x, int z, double v) {
|
||||
data.set((z << 4) | x, v);
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/volmit/iris/gen/atomics/AtomicIntMap.java
Normal file
19
src/main/java/com/volmit/iris/gen/atomics/AtomicIntMap.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.volmit.iris.gen.atomics;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicIntegerArray;
|
||||
|
||||
public class AtomicIntMap {
|
||||
private final AtomicIntegerArray data;
|
||||
|
||||
public AtomicIntMap() {
|
||||
data = new AtomicIntegerArray(256);
|
||||
}
|
||||
|
||||
public int get(int x, int z) {
|
||||
return data.get((z << 4) | x);
|
||||
}
|
||||
|
||||
public void set(int x, int z, int v) {
|
||||
data.set((z << 4) | x, v);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.volmit.iris.gen.atomics;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicReferenceArray;
|
||||
|
||||
public class AtomicObjectMap<T> {
|
||||
private final AtomicReferenceArray<T> data;
|
||||
|
||||
public AtomicObjectMap() {
|
||||
data = new AtomicReferenceArray<T>(256);
|
||||
}
|
||||
|
||||
public T get(int x, int z) {
|
||||
return data.get((z << 4) | x);
|
||||
}
|
||||
|
||||
public void set(int x, int z, T v) {
|
||||
data.set((z << 4) | x, v);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.volmit.iris.gen.atomics;
|
||||
|
||||
import com.volmit.iris.object.IrisRegion;
|
||||
|
||||
public class AtomicRegionMap extends AtomicObjectMap<IrisRegion> {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user