9
0
mirror of https://github.com/VolmitSoftware/Iris.git synced 2025-12-27 11:09:06 +00:00

Random variable tweaks & opts

This commit is contained in:
cyberpwn
2022-01-13 07:14:16 -05:00
parent 62c2757afc
commit 32a0fc9b17
13 changed files with 34 additions and 45 deletions

View File

@@ -50,7 +50,6 @@ public class Board {
private final Player player;
private final Objective objective;
private final Team team;
@Setter
private BoardSettings boardSettings;
private boolean ready;
@@ -61,11 +60,11 @@ public class Board {
this.boardSettings = boardSettings;
this.objective = this.getScoreboard().getObjective("board") == null ? this.getScoreboard().registerNewObjective("board", "dummy") : this.getScoreboard().getObjective("board");
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
this.team = this.getScoreboard().getTeam("board") == null ? this.getScoreboard().registerNewTeam("board") : this.getScoreboard().getTeam("board");
this.team.setAllowFriendlyFire(true);
this.team.setCanSeeFriendlyInvisibles(false);
this.team.setPrefix("");
this.team.setSuffix("");
Team team = this.getScoreboard().getTeam("board") == null ? this.getScoreboard().registerNewTeam("board") : this.getScoreboard().getTeam("board");
team.setAllowFriendlyFire(true);
team.setCanSeeFriendlyInvisibles(false);
team.setPrefix("");
team.setSuffix("");
this.ready = true;
}

View File

@@ -68,7 +68,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
data = new NibbleArray(CAPACITY, i);
}
private final void expand() {
private void expand() {
if(bpb < 8) {
changeBitsPerBlock(bpb + 1);
} else {
@@ -90,7 +90,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
changeBitsPerBlock(targetBits);
}
private final void changeBitsPerBlock(int bits) {
private void changeBitsPerBlock(int bits) {
bpb = bits;
data = new NibbleArray(bpb, CAPACITY, data);
}
@@ -103,7 +103,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
return palette.get(data.get(getCoordinateIndex(x, y, z)));
}
private final int getPaletteId(T d) {
private int getPaletteId(T d) {
int index = palette.indexOf(d);
if(index == -1) {
@@ -118,7 +118,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
return index + Byte.MIN_VALUE;
}
private final int getCoordinateIndex(int x, int y, int z) {
private int getCoordinateIndex(int x, int y, int z) {
return y << 8 | z << 4 | x;
}
}

View File

@@ -22,7 +22,6 @@ import java.io.File;
public class FileWatcher {
protected final File file;
private boolean exists;
private long lastModified;
private long size;
@@ -32,7 +31,7 @@ public class FileWatcher {
}
protected void readProperties() {
exists = file.exists();
boolean exists = file.exists();
lastModified = exists ? file.lastModified() : -1;
size = exists ? file.isDirectory() ? -2 : file.length() : -1;
}

View File

@@ -376,9 +376,7 @@ public class IrisMathHelper {
var9 = var5;
var10 = var6;
}
default -> {
throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + var0 + ", " + var1 + ", " + var2);
}
default -> throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + var0 + ", " + var1 + ", " + var2);
}
final int var11 = clamp((int) (var8 * 255.0f), 0, 255);
final int var12 = clamp((int) (var9 * 255.0f), 0, 255);

View File

@@ -30,7 +30,6 @@ public class Section {
private MCAPaletteAccess palette;
private byte[] blockLight;
private byte[] skyLight;
private int dataVersion;
public Section(CompoundTag sectionRoot, int dataVersion) {
this(sectionRoot, dataVersion, LoadFlags.ALL_DATA);
@@ -38,7 +37,6 @@ public class Section {
public Section(CompoundTag sectionRoot, int dataVersion, long loadFlags) {
data = sectionRoot;
this.dataVersion = dataVersion;
ListTag<?> rawPalette = sectionRoot.getListTag("Palette");
if(rawPalette == null) {
return;

View File

@@ -1190,9 +1190,6 @@ public class FastNoise {
return sum;
}
// private final static float F2 = (float) (1.0 / 2.0);
// private final static float G2 = (float) (1.0 / 4.0);
public float GetSimplex(float x, float y) {
return SingleSimplex(m_seed, x * m_frequency, y * m_frequency);
}

View File

@@ -43,15 +43,29 @@ public class SemaphoreStream<T> extends BasicStream<T> {
@Override
public T get(double x, double z) {
synchronized(getTypedSource()) {
return getTypedSource().get(x, z);
try {
semaphore.acquire();
T t = getTypedSource().get(x, z);
semaphore.release();
return t;
} catch(InterruptedException e) {
e.printStackTrace();
}
return null;
}
@Override
public T get(double x, double y, double z) {
synchronized(getTypedSource()) {
return getTypedSource().get(x, y, z);
try {
semaphore.acquire();
T t = getTypedSource().get(x, y, z);
semaphore.release();
return t;
} catch(InterruptedException e) {
e.printStackTrace();
}
return null;
}
}