This commit is contained in:
Daniel Mills 2021-08-10 07:19:17 -04:00
parent 7637905de2
commit c5c1a9b25b
4 changed files with 22 additions and 2 deletions

View File

@ -255,7 +255,6 @@ public interface Matter {
*/
Map<Class<?>, MatterSlice<?>> getSliceMap();
default void write(File f) throws IOException {
write(f, true);
}

View File

@ -28,7 +28,7 @@ import java.io.IOException;
@Data
public class MatterHeader {
private String author = "anonymous";
private String author = "";
private long createdAt = M.ms();
private int version = Matter.VERSION;

View File

@ -18,7 +18,9 @@
package com.volmit.iris.util.matter;
import com.volmit.iris.Iris;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.util.data.NibbleDataPalette;
import com.volmit.iris.util.data.Varint;
import com.volmit.iris.util.hunk.Hunk;
import org.bukkit.Location;
@ -106,6 +108,19 @@ public interface MatterSlice<T> extends Hunk<T> {
return readFrom(mediumType) != null;
}
default int getBitsPer(int needed)
{
int target = 1;
for (int i = 1; i < 8; i++) {
if (Math.pow(2, i) > needed) {
target = i;
break;
}
}
return target;
}
default void write(DataOutputStream dos) throws IOException {
int w = getWidth();
int h = getHeight();

View File

@ -63,6 +63,12 @@ public class HyperLock {
unlock(x, z);
}
public void withLong(long k, Runnable r) {
lock(Cache.keyX(k), Cache.keyZ(k));
r.run();
unlock(Cache.keyX(k), Cache.keyZ(k));
}
public void withNasty(int x, int z, NastyRunnable r) throws Throwable {
lock(x, z);
Throwable ee = null;