mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Auto stash before revert of "Cleanup"
This commit is contained in:
parent
2aa240337c
commit
8ff5887955
@ -125,10 +125,12 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void drawRegion(int x, int z, Color color) {
|
public void drawRegion(int x, int z, Color color) {
|
||||||
J.a(() -> PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
J.a(() -> {
|
||||||
draw(xx, zz, color);
|
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||||
J.sleep(3);
|
draw(xx, zz, color);
|
||||||
}));
|
J.sleep(3);
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(int x, int z, Color color) {
|
public void draw(int x, int z, Color color) {
|
||||||
|
@ -36,7 +36,7 @@ public class INMS {
|
|||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getNMSTag() {
|
public static final String getNMSTag() {
|
||||||
if (IrisSettings.get().getGeneral().isDisableNMS()) {
|
if (IrisSettings.get().getGeneral().isDisableNMS()) {
|
||||||
return "BUKKIT";
|
return "BUKKIT";
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ public class INMS {
|
|||||||
return "BUKKIT";
|
return "BUKKIT";
|
||||||
}
|
}
|
||||||
|
|
||||||
private static INMSBinding bind() {
|
private static final INMSBinding bind() {
|
||||||
String code = getNMSTag();
|
String code = getNMSTag();
|
||||||
Iris.info("Locating NMS Binding for " + code);
|
Iris.info("Locating NMS Binding for " + code);
|
||||||
|
|
||||||
|
@ -23,11 +23,18 @@ import com.volmit.iris.core.service.StudioSVC;
|
|||||||
import com.volmit.iris.util.data.IrisPackRepository;
|
import com.volmit.iris.util.data.IrisPackRepository;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
import com.volmit.iris.util.plugin.VolmitSender;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
|
|
||||||
public record IrisPack(File folder) {
|
@Data
|
||||||
|
public class IrisPack {
|
||||||
|
private final File folder;
|
||||||
|
|
||||||
|
public IrisPack(File folder) {
|
||||||
|
this.folder = folder;
|
||||||
|
}
|
||||||
|
|
||||||
public void delete() {
|
public void delete() {
|
||||||
IO.delete(folder);
|
IO.delete(folder);
|
||||||
|
@ -124,8 +124,8 @@ public class IrisData {
|
|||||||
IrisContext ctx = IrisContext.get();
|
IrisContext ctx = IrisContext.get();
|
||||||
Engine engine = this.engine;
|
Engine engine = this.engine;
|
||||||
|
|
||||||
if (engine == null && ctx != null && ctx.engine() != null) {
|
if (engine == null && ctx != null && ctx.getEngine() != null) {
|
||||||
engine = ctx.engine();
|
engine = ctx.getEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine == null && t.getPreprocessors().isNotEmpty()) {
|
if (engine == null && t.getPreprocessors().isNotEmpty()) {
|
||||||
@ -196,7 +196,8 @@ public class IrisData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
loaders.clear();
|
loaders.clear();
|
||||||
dataFolder.mkdirs();
|
File packs = dataFolder;
|
||||||
|
packs.mkdirs();
|
||||||
this.lootLoader = registerLoader(IrisLootTable.class);
|
this.lootLoader = registerLoader(IrisLootTable.class);
|
||||||
this.spawnerLoader = registerLoader(IrisSpawner.class);
|
this.spawnerLoader = registerLoader(IrisSpawner.class);
|
||||||
this.entityLoader = registerLoader(IrisEntity.class);
|
this.entityLoader = registerLoader(IrisEntity.class);
|
||||||
@ -323,7 +324,7 @@ public class IrisData {
|
|||||||
if (f.getPath().startsWith(getDataFolder().getPath())) {
|
if (f.getPath().startsWith(getDataFolder().getPath())) {
|
||||||
String[] full = f.getPath().split("\\Q" + File.separator + "\\E");
|
String[] full = f.getPath().split("\\Q" + File.separator + "\\E");
|
||||||
String[] df = getDataFolder().getPath().split("\\Q" + File.separator + "\\E");
|
String[] df = getDataFolder().getPath().split("\\Q" + File.separator + "\\E");
|
||||||
StringBuilder g = new StringBuilder();
|
String g = "";
|
||||||
boolean m = true;
|
boolean m = true;
|
||||||
for (int i = 0; i < full.length; i++) {
|
for (int i = 0; i < full.length; i++) {
|
||||||
if (i >= df.length) {
|
if (i >= df.length) {
|
||||||
@ -332,11 +333,12 @@ public class IrisData {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
g.append("/").append(full[i]);
|
g += "/" + full[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return g.substring(1).split("\\Q.\\E")[0];
|
String ff = g.substring(1).split("\\Q.\\E")[0];
|
||||||
|
return ff;
|
||||||
} else {
|
} else {
|
||||||
Iris.error("Forign file from loader " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
|
Iris.error("Forign file from loader " + f.getPath() + " (loader realm: " + getDataFolder().getPath() + ")");
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,8 @@ public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
|||||||
String key = name + "-" + objectClass.getCanonicalName();
|
String key = name + "-" + objectClass.getCanonicalName();
|
||||||
|
|
||||||
if (loadCache.containsKey(key)) {
|
if (loadCache.containsKey(key)) {
|
||||||
return loadCache.get(key);
|
IrisScript t = loadCache.get(key);
|
||||||
|
return t;
|
||||||
}
|
}
|
||||||
|
|
||||||
lock.lock();
|
lock.lock();
|
||||||
|
@ -21,6 +21,7 @@ package com.volmit.iris.core.service;
|
|||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.project.IrisProject;
|
import com.volmit.iris.core.project.IrisProject;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
import com.volmit.iris.core.project.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
@ -55,17 +56,12 @@ public class StudioSVC implements IrisService {
|
|||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
J.a(() ->
|
J.a(() ->
|
||||||
{
|
{
|
||||||
File ignore = getWorkspaceFile(".gitignore");
|
File project = Iris.instance.getDataFolder(WORKSPACE_NAME, IrisSettings.get().getGenerator().getDefaultWorldType());
|
||||||
|
|
||||||
if (!ignore.exists()) {
|
if(!project.exists())
|
||||||
File m = Iris.getCached("Pack Ignore (.gitignore)", "https://raw.githubusercontent.com/VolmitSoftware/Iris/master/packignore.ignore");
|
{
|
||||||
if (m != null) {
|
Iris.info("Attempting to download default pack " + IrisSettings.get().getGenerator().getDefaultWorldType());
|
||||||
try {
|
downloadSearch(Iris.getSender(), IrisSettings.get().getGenerator().getDefaultWorldType(), false, false);
|
||||||
IO.copyFile(m, ignore);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,9 @@ public class IrisCreator {
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
J.sfut(() -> world.set(wc.createWorld())).get();
|
J.sfut(() -> {
|
||||||
|
world.set(wc.createWorld());
|
||||||
|
}).get();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -147,7 +149,9 @@ public class IrisCreator {
|
|||||||
done.set(true);
|
done.set(true);
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
J.s(() -> sender.player().teleport(new Location(world.get(), 0, world.get().getHighestBlockYAt(0, 0), 0)));
|
J.s(() -> {
|
||||||
|
sender.player().teleport(new Location(world.get(), 0, world.get().getHighestBlockYAt(0, 0), 0));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (studio) {
|
if (studio) {
|
||||||
|
@ -84,7 +84,9 @@ public class IrisCarveLayer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ProceduralStream<Double> rawStream(RNG rng, IrisData data) {
|
public ProceduralStream<Double> rawStream(RNG rng, IrisData data) {
|
||||||
return rawStreamCache.aquire(() -> ProceduralStream.of((x, y, z) -> getCng(rng, data).fitDouble(0D, 1D, x, y, z) * Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4), Interpolated.DOUBLE));
|
return rawStreamCache.aquire(() -> ProceduralStream.of((x, y, z) -> {
|
||||||
|
return getCng(rng, data).fitDouble(0D, 1D, x, y, z) * Math.pow(IrisInterpolation.sinCenter(M.lerpInverse(getMinHeight(), getMaxHeight(), y)), 4);
|
||||||
|
}, Interpolated.DOUBLE));
|
||||||
}
|
}
|
||||||
|
|
||||||
public CNG getCng(RNG rng, IrisData data) {
|
public CNG getCng(RNG rng, IrisData data) {
|
||||||
|
@ -70,10 +70,8 @@ public class IrisDecorator {
|
|||||||
private int stackMax = 1;
|
private int stackMax = 1;
|
||||||
|
|
||||||
@DependsOn({"stackMin", "stackMax"})
|
@DependsOn({"stackMin", "stackMax"})
|
||||||
@Desc("""
|
@Desc("Changes stackMin and stackMin from being absolute block heights and instead uses them as a percentage to scale the stack based on the cave height" +
|
||||||
Changes stackMin and stackMin from being absolute block heights and instead uses them as a percentage to scale the stack based on the cave height
|
"\n\nWithin a cave, setting them stackMin/max to 50 would make the stack 50% of the cave height")
|
||||||
|
|
||||||
Within a cave, setting them stackMin/max to 50 would make the stack 50% of the cave height""")
|
|
||||||
private boolean scaleStack = false;
|
private boolean scaleStack = false;
|
||||||
|
|
||||||
@Required
|
@Required
|
||||||
|
@ -560,6 +560,10 @@ public class IrisRegion extends IrisRegistrant implements IRare {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void pickRandomColor(DataProvider data) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFolderName() {
|
public String getFolderName() {
|
||||||
return "regions";
|
return "regions";
|
||||||
|
@ -24,10 +24,15 @@ import com.volmit.iris.engine.IrisComplex;
|
|||||||
import com.volmit.iris.engine.framework.Engine;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
public record IrisContext(Engine engine) {
|
@Data
|
||||||
private static final ChronoLatch cl = new ChronoLatch(60000);
|
@AllArgsConstructor
|
||||||
|
public class IrisContext {
|
||||||
|
private static ChronoLatch cl = new ChronoLatch(60000);
|
||||||
private static final KMap<Thread, IrisContext> context = new KMap<>();
|
private static final KMap<Thread, IrisContext> context = new KMap<>();
|
||||||
|
private final Engine engine;
|
||||||
|
|
||||||
public static IrisContext get() {
|
public static IrisContext get() {
|
||||||
return context.get(Thread.currentThread());
|
return context.get(Thread.currentThread());
|
||||||
|
@ -380,12 +380,13 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
|
|||||||
* @return a new Cuboid outset by the given direction and amount
|
* @return a new Cuboid outset by the given direction and amount
|
||||||
*/
|
*/
|
||||||
public Cuboid outset(CuboidDirection dir, int amount) {
|
public Cuboid outset(CuboidDirection dir, int amount) {
|
||||||
return switch (dir) {
|
Cuboid c = switch (dir) {
|
||||||
case Horizontal -> expand(CuboidDirection.North, amount).expand(CuboidDirection.South, amount).expand(CuboidDirection.East, amount).expand(CuboidDirection.West, amount);
|
case Horizontal -> expand(CuboidDirection.North, amount).expand(CuboidDirection.South, amount).expand(CuboidDirection.East, amount).expand(CuboidDirection.West, amount);
|
||||||
case Vertical -> expand(CuboidDirection.Down, amount).expand(CuboidDirection.Up, amount);
|
case Vertical -> expand(CuboidDirection.Down, amount).expand(CuboidDirection.Up, amount);
|
||||||
case Both -> outset(CuboidDirection.Horizontal, amount).outset(CuboidDirection.Vertical, amount);
|
case Both -> outset(CuboidDirection.Horizontal, amount).outset(CuboidDirection.Vertical, amount);
|
||||||
default -> throw new IllegalArgumentException("invalid direction " + dir);
|
default -> throw new IllegalArgumentException("invalid direction " + dir);
|
||||||
};
|
};
|
||||||
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -68,7 +68,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
|
|||||||
data = new NibbleArray(CAPACITY, i);
|
data = new NibbleArray(CAPACITY, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void expand() {
|
private final void expand() {
|
||||||
if (bpb < 8) {
|
if (bpb < 8) {
|
||||||
changeBitsPerBlock(bpb + 1);
|
changeBitsPerBlock(bpb + 1);
|
||||||
} else {
|
} else {
|
||||||
@ -90,7 +90,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
|
|||||||
changeBitsPerBlock(targetBits);
|
changeBitsPerBlock(targetBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changeBitsPerBlock(int bits) {
|
private final void changeBitsPerBlock(int bits) {
|
||||||
bpb = bits;
|
bpb = bits;
|
||||||
data = new NibbleArray(bpb, CAPACITY, data);
|
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)));
|
return palette.get(data.get(getCoordinateIndex(x, y, z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getPaletteId(T d) {
|
private final int getPaletteId(T d) {
|
||||||
int index = palette.indexOf(d);
|
int index = palette.indexOf(d);
|
||||||
|
|
||||||
if (index == -1) {
|
if (index == -1) {
|
||||||
@ -118,7 +118,7 @@ public abstract class NibbleDataPalette<T> implements Writable {
|
|||||||
return index + Byte.MIN_VALUE;
|
return index + Byte.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getCoordinateIndex(int x, int y, int z) {
|
private final int getCoordinateIndex(int x, int y, int z) {
|
||||||
return y << 8 | z << 4 | x;
|
return y << 8 | z << 4 | x;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,8 +277,10 @@ public class Form {
|
|||||||
if (phantom > div) {
|
if (phantom > div) {
|
||||||
phantom /= div;
|
phantom /= div;
|
||||||
suffix = "Year";
|
suffix = "Year";
|
||||||
|
return Form.fd(phantom, 0) + " " + suffix + ((int) phantom == 1 ? "" : "s");
|
||||||
|
} else {
|
||||||
|
return Form.fd(phantom, 0) + " " + suffix + ((int) phantom == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
return Form.fd(phantom, 0) + " " + suffix + ((int) phantom == 1 ? "" : "s");
|
|
||||||
} else {
|
} else {
|
||||||
return Form.fd(phantom, 0) + " " + suffix + ((int) phantom == 1 ? "" : "s");
|
return Form.fd(phantom, 0) + " " + suffix + ((int) phantom == 1 ? "" : "s");
|
||||||
}
|
}
|
||||||
|
@ -196,7 +196,8 @@ public class RandomColor {
|
|||||||
int saturation = pickSaturation(color, null, null);
|
int saturation = pickSaturation(color, null, null);
|
||||||
int brightness = pickBrightness(color, saturation, null);
|
int brightness = pickBrightness(color, saturation, null);
|
||||||
|
|
||||||
return getColor(hue, saturation, brightness);
|
int colorValue = getColor(hue, saturation, brightness);
|
||||||
|
return colorValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int[] random(Color color, int count) {
|
public int[] random(Color color, int count) {
|
||||||
@ -261,13 +262,18 @@ public class RandomColor {
|
|||||||
|
|
||||||
private int pickSaturation(ColorInfo colorInfo, SaturationType saturationType, Luminosity luminosity) {
|
private int pickSaturation(ColorInfo colorInfo, SaturationType saturationType, Luminosity luminosity) {
|
||||||
if (saturationType != null) {
|
if (saturationType != null) {
|
||||||
return switch (saturationType) {
|
switch (saturationType) {
|
||||||
case RANDOM -> randomWithin(new Range(0, 100));
|
case RANDOM:
|
||||||
case MONOCHROME -> 0;
|
return randomWithin(new Range(0, 100));
|
||||||
case HIGH -> randomWithin(new Range(75, 100));
|
case MONOCHROME:
|
||||||
case MEDIUM -> randomWithin(new Range(55, 75));
|
return 0;
|
||||||
case LOW -> randomWithin(new Range(35, 55));
|
case HIGH:
|
||||||
};
|
return randomWithin(new Range(75, 100));
|
||||||
|
case MEDIUM:
|
||||||
|
return randomWithin(new Range(55, 75));
|
||||||
|
case LOW:
|
||||||
|
return randomWithin(new Range(35, 55));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (colorInfo == null) {
|
if (colorInfo == null) {
|
||||||
@ -281,9 +287,15 @@ public class RandomColor {
|
|||||||
|
|
||||||
if (luminosity != null) {
|
if (luminosity != null) {
|
||||||
switch (luminosity) {
|
switch (luminosity) {
|
||||||
case LIGHT -> min = 55;
|
case LIGHT:
|
||||||
case BRIGHT -> min = max - 10;
|
min = 55;
|
||||||
case DARK -> max = 55;
|
break;
|
||||||
|
case BRIGHT:
|
||||||
|
min = max - 10;
|
||||||
|
break;
|
||||||
|
case DARK:
|
||||||
|
max = 55;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -308,12 +320,19 @@ public class RandomColor {
|
|||||||
|
|
||||||
if (luminosity != null) {
|
if (luminosity != null) {
|
||||||
switch (luminosity) {
|
switch (luminosity) {
|
||||||
case DARK -> max = min + 20;
|
|
||||||
case LIGHT -> min = (max + min) / 2;
|
case DARK:
|
||||||
case RANDOM -> {
|
max = min + 20;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LIGHT:
|
||||||
|
min = (max + min) / 2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RANDOM:
|
||||||
min = 0;
|
min = 0;
|
||||||
max = 100;
|
max = 100;
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -361,7 +361,9 @@ public class IrisMathHelper {
|
|||||||
var9 = var5;
|
var9 = var5;
|
||||||
var10 = var6;
|
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 var11 = clamp((int) (var8 * 255.0f), 0, 255);
|
||||||
final int var12 = clamp((int) (var9 * 255.0f), 0, 255);
|
final int var12 = clamp((int) (var9 * 255.0f), 0, 255);
|
||||||
|
@ -197,15 +197,19 @@ public class KochanekBartelsInterpolation implements PathInterpolation {
|
|||||||
* Assumes a < b.
|
* Assumes a < b.
|
||||||
*/
|
*/
|
||||||
private double arcLengthRecursive(int indexLeft, double remainderLeft, int indexRight, double remainderRight) {
|
private double arcLengthRecursive(int indexLeft, double remainderLeft, int indexRight, double remainderRight) {
|
||||||
return switch (indexRight - indexLeft) {
|
switch (indexRight - indexLeft) {
|
||||||
case 0 -> arcLengthRecursive(indexLeft, remainderLeft, remainderRight);
|
case 0:
|
||||||
case 1 ->
|
return arcLengthRecursive(indexLeft, remainderLeft, remainderRight);
|
||||||
// This case is merely a speed-up for a very common case
|
|
||||||
arcLengthRecursive(indexLeft, remainderLeft, 1.0)
|
case 1:
|
||||||
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
|
// This case is merely a speed-up for a very common case
|
||||||
default -> arcLengthRecursive(indexLeft, remainderLeft, indexRight - 1, 1.0)
|
return arcLengthRecursive(indexLeft, remainderLeft, 1.0)
|
||||||
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
|
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
|
||||||
};
|
|
||||||
|
default:
|
||||||
|
return arcLengthRecursive(indexLeft, remainderLeft, indexRight - 1, 1.0)
|
||||||
|
+ arcLengthRecursive(indexRight, 0.0, remainderRight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private double arcLengthRecursive(int index, double remainderLeft, double remainderRight) {
|
private double arcLengthRecursive(int index, double remainderLeft, double remainderRight) {
|
||||||
|
@ -200,10 +200,11 @@ public class MathHelper {
|
|||||||
|
|
||||||
public static double a(long[] var0) {
|
public static double a(long[] var0) {
|
||||||
long var1 = 0L;
|
long var1 = 0L;
|
||||||
|
long[] var3 = var0;
|
||||||
int var4 = var0.length;
|
int var4 = var0.length;
|
||||||
|
|
||||||
for (int var5 = 0; var5 < var4; ++var5) {
|
for (int var5 = 0; var5 < var4; ++var5) {
|
||||||
long var6 = var0[var5];
|
long var6 = var3[var5];
|
||||||
var1 += var6;
|
var1 += var6;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -451,7 +452,7 @@ public class MathHelper {
|
|||||||
public static double d(double var0, double var2) {
|
public static double d(double var0, double var2) {
|
||||||
double var4 = var2 * var2 + var0 * var0;
|
double var4 = var2 * var2 + var0 * var0;
|
||||||
if (Double.isNaN(var4)) {
|
if (Double.isNaN(var4)) {
|
||||||
return Double.NaN;
|
return 0.0D / 0.0;
|
||||||
} else {
|
} else {
|
||||||
boolean var6 = var0 < 0.0D;
|
boolean var6 = var0 < 0.0D;
|
||||||
if (var6) {
|
if (var6) {
|
||||||
@ -535,37 +536,38 @@ public class MathHelper {
|
|||||||
float var9;
|
float var9;
|
||||||
float var10;
|
float var10;
|
||||||
switch (var3) {
|
switch (var3) {
|
||||||
case 0 -> {
|
case 0:
|
||||||
var8 = var2;
|
var8 = var2;
|
||||||
var9 = var7;
|
var9 = var7;
|
||||||
var10 = var5;
|
var10 = var5;
|
||||||
}
|
break;
|
||||||
case 1 -> {
|
case 1:
|
||||||
var8 = var6;
|
var8 = var6;
|
||||||
var9 = var2;
|
var9 = var2;
|
||||||
var10 = var5;
|
var10 = var5;
|
||||||
}
|
break;
|
||||||
case 2 -> {
|
case 2:
|
||||||
var8 = var5;
|
var8 = var5;
|
||||||
var9 = var2;
|
var9 = var2;
|
||||||
var10 = var7;
|
var10 = var7;
|
||||||
}
|
break;
|
||||||
case 3 -> {
|
case 3:
|
||||||
var8 = var5;
|
var8 = var5;
|
||||||
var9 = var6;
|
var9 = var6;
|
||||||
var10 = var2;
|
var10 = var2;
|
||||||
}
|
break;
|
||||||
case 4 -> {
|
case 4:
|
||||||
var8 = var7;
|
var8 = var7;
|
||||||
var9 = var5;
|
var9 = var5;
|
||||||
var10 = var2;
|
var10 = var2;
|
||||||
}
|
break;
|
||||||
case 5 -> {
|
case 5:
|
||||||
var8 = var2;
|
var8 = var2;
|
||||||
var9 = var5;
|
var9 = var5;
|
||||||
var10 = var6;
|
var10 = var6;
|
||||||
}
|
break;
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
int var11 = clamp((int) (var8 * 255.0F), 0, 255);
|
int var11 = clamp((int) (var8 * 255.0F), 0, 255);
|
||||||
@ -594,10 +596,11 @@ public class MathHelper {
|
|||||||
|
|
||||||
public static double[] a(double... var0) {
|
public static double[] a(double... var0) {
|
||||||
float var1 = 0.0F;
|
float var1 = 0.0F;
|
||||||
|
double[] var2f = var0;
|
||||||
int var3 = var0.length;
|
int var3 = var0.length;
|
||||||
|
|
||||||
for (int var4 = 0; var4 < var3; ++var4) {
|
for (int var4 = 0; var4 < var3; ++var4) {
|
||||||
double var5 = var0[var4];
|
double var5 = var2f[var4];
|
||||||
var1 = (float) ((double) var1 + var5);
|
var1 = (float) ((double) var1 + var5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,71 +265,85 @@ public class VectorMath {
|
|||||||
KList<BlockFace> faces = new KList<>();
|
KList<BlockFace> faces = new KList<>();
|
||||||
|
|
||||||
switch (f) {
|
switch (f) {
|
||||||
case DOWN -> faces.add(BlockFace.DOWN);
|
case DOWN:
|
||||||
case EAST -> faces.add(BlockFace.EAST);
|
faces.add(BlockFace.DOWN);
|
||||||
case EAST_NORTH_EAST -> {
|
break;
|
||||||
|
case EAST:
|
||||||
|
faces.add(BlockFace.EAST);
|
||||||
|
break;
|
||||||
|
case EAST_NORTH_EAST:
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
}
|
break;
|
||||||
case EAST_SOUTH_EAST -> {
|
case EAST_SOUTH_EAST:
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
}
|
break;
|
||||||
case NORTH -> faces.add(BlockFace.NORTH);
|
case NORTH:
|
||||||
case NORTH_EAST -> {
|
faces.add(BlockFace.NORTH);
|
||||||
|
break;
|
||||||
|
case NORTH_EAST:
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
}
|
break;
|
||||||
case NORTH_NORTH_EAST -> {
|
case NORTH_NORTH_EAST:
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
}
|
break;
|
||||||
case NORTH_NORTH_WEST -> {
|
case NORTH_NORTH_WEST:
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
}
|
break;
|
||||||
case NORTH_WEST -> {
|
case NORTH_WEST:
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
}
|
break;
|
||||||
case SELF -> faces.add(BlockFace.SELF);
|
case SELF:
|
||||||
case SOUTH -> faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SELF);
|
||||||
case SOUTH_EAST -> {
|
break;
|
||||||
|
case SOUTH:
|
||||||
|
faces.add(BlockFace.SOUTH);
|
||||||
|
break;
|
||||||
|
case SOUTH_EAST:
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
}
|
break;
|
||||||
case SOUTH_SOUTH_EAST -> {
|
case SOUTH_SOUTH_EAST:
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
faces.add(BlockFace.EAST);
|
faces.add(BlockFace.EAST);
|
||||||
}
|
break;
|
||||||
case SOUTH_SOUTH_WEST -> {
|
case SOUTH_SOUTH_WEST:
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
}
|
break;
|
||||||
case SOUTH_WEST -> {
|
case SOUTH_WEST:
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
}
|
break;
|
||||||
case UP -> faces.add(BlockFace.UP);
|
case UP:
|
||||||
case WEST -> faces.add(BlockFace.WEST);
|
faces.add(BlockFace.UP);
|
||||||
case WEST_NORTH_WEST -> {
|
break;
|
||||||
|
case WEST:
|
||||||
|
faces.add(BlockFace.WEST);
|
||||||
|
break;
|
||||||
|
case WEST_NORTH_WEST:
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
faces.add(BlockFace.NORTH);
|
faces.add(BlockFace.NORTH);
|
||||||
}
|
break;
|
||||||
case WEST_SOUTH_WEST -> {
|
case WEST_SOUTH_WEST:
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
faces.add(BlockFace.WEST);
|
faces.add(BlockFace.WEST);
|
||||||
faces.add(BlockFace.SOUTH);
|
faces.add(BlockFace.SOUTH);
|
||||||
}
|
break;
|
||||||
default -> {
|
default:
|
||||||
}
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return faces;
|
return faces;
|
||||||
|
@ -19,6 +19,14 @@
|
|||||||
package com.volmit.iris.util.matter;
|
package com.volmit.iris.util.matter;
|
||||||
|
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
public record MatterEntity(double xOff, double yOff, double zOff, CompoundTag entityData) {
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MatterEntity {
|
||||||
|
private final double xOff;
|
||||||
|
private final double yOff;
|
||||||
|
private final double zOff;
|
||||||
|
private final CompoundTag entityData;
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,11 @@
|
|||||||
package com.volmit.iris.util.matter;
|
package com.volmit.iris.util.matter;
|
||||||
|
|
||||||
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
import com.volmit.iris.util.nbt.tag.CompoundTag;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
public record MatterTile(CompoundTag tileData) {
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MatterTile {
|
||||||
|
private final CompoundTag tileData;
|
||||||
}
|
}
|
||||||
|
@ -50,8 +50,8 @@ public class EntityMatter extends RawMatter<MatterEntityGroup> {
|
|||||||
super(width, height, depth, MatterEntityGroup.class);
|
super(width, height, depth, MatterEntityGroup.class);
|
||||||
registerWriter(World.class, ((w, d, x, y, z) -> {
|
registerWriter(World.class, ((w, d, x, y, z) -> {
|
||||||
for (MatterEntity i : d.getEntities()) {
|
for (MatterEntity i : d.getEntities()) {
|
||||||
Location realPosition = new Location(w, x + i.xOff(), y + i.yOff(), z + i.zOff());
|
Location realPosition = new Location(w, x + i.getXOff(), y + i.getYOff(), z + i.getZOff());
|
||||||
INMS.get().deserializeEntity(i.entityData(), realPosition);
|
INMS.get().deserializeEntity(i.getEntityData(), realPosition);
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
registerReader(World.class, (w, x, y, z) -> {
|
registerReader(World.class, (w, x, y, z) -> {
|
||||||
@ -124,10 +124,10 @@ public class EntityMatter extends RawMatter<MatterEntityGroup> {
|
|||||||
public void writeNode(MatterEntityGroup b, DataOutputStream dos) throws IOException {
|
public void writeNode(MatterEntityGroup b, DataOutputStream dos) throws IOException {
|
||||||
Varint.writeUnsignedVarInt(b.getEntities().size(), dos);
|
Varint.writeUnsignedVarInt(b.getEntities().size(), dos);
|
||||||
for (MatterEntity i : b.getEntities()) {
|
for (MatterEntity i : b.getEntities()) {
|
||||||
dos.writeByte((int) (i.xOff() * 255) + Byte.MIN_VALUE);
|
dos.writeByte((int) (i.getXOff() * 255) + Byte.MIN_VALUE);
|
||||||
dos.writeByte((int) (i.yOff() * 255) + Byte.MIN_VALUE);
|
dos.writeByte((int) (i.getYOff() * 255) + Byte.MIN_VALUE);
|
||||||
dos.writeByte((int) (i.zOff() * 255) + Byte.MIN_VALUE);
|
dos.writeByte((int) (i.getZOff() * 255) + Byte.MIN_VALUE);
|
||||||
NBTUtil.write(i.entityData(), dos, false);
|
NBTUtil.write(i.getEntityData(), dos, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class TileMatter extends RawMatter<MatterTile> {
|
|||||||
|
|
||||||
public TileMatter(int width, int height, int depth) {
|
public TileMatter(int width, int height, int depth) {
|
||||||
super(width, height, depth, MatterTile.class);
|
super(width, height, depth, MatterTile.class);
|
||||||
registerWriter(World.class, ((w, d, x, y, z) -> INMS.get().deserializeTile(d.tileData(), new Location(w, x, y, z))));
|
registerWriter(World.class, ((w, d, x, y, z) -> INMS.get().deserializeTile(d.getTileData(), new Location(w, x, y, z))));
|
||||||
registerReader(World.class, (w, x, y, z) -> {
|
registerReader(World.class, (w, x, y, z) -> {
|
||||||
Location l = new Location(w, x, y, z);
|
Location l = new Location(w, x, y, z);
|
||||||
if (INMS.get().hasTile(l)) {
|
if (INMS.get().hasTile(l)) {
|
||||||
@ -55,7 +55,7 @@ public class TileMatter extends RawMatter<MatterTile> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void writeNode(MatterTile b, DataOutputStream dos) throws IOException {
|
public void writeNode(MatterTile b, DataOutputStream dos) throws IOException {
|
||||||
NBTUtil.write(b.tileData(), dos, false);
|
NBTUtil.write(b.getTileData(), dos, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -494,7 +494,7 @@ public class Mth {
|
|||||||
float var6 = var2 * (1.0F - var4 * var1);
|
float var6 = var2 * (1.0F - var4 * var1);
|
||||||
float var7 = var2 * (1.0F - (1.0F - var4) * var1);
|
float var7 = var2 * (1.0F - (1.0F - var4) * var1);
|
||||||
switch (var3) {
|
switch (var3) {
|
||||||
case 0 -> {
|
case 0:
|
||||||
var8 = var2;
|
var8 = var2;
|
||||||
var9 = var7;
|
var9 = var7;
|
||||||
var10 = var5;
|
var10 = var5;
|
||||||
@ -502,8 +502,7 @@ public class Mth {
|
|||||||
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
||||||
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
||||||
return var11 << 16 | var12 << 8 | var13;
|
return var11 << 16 | var12 << 8 | var13;
|
||||||
}
|
case 1:
|
||||||
case 1 -> {
|
|
||||||
var8 = var6;
|
var8 = var6;
|
||||||
var9 = var2;
|
var9 = var2;
|
||||||
var10 = var5;
|
var10 = var5;
|
||||||
@ -511,8 +510,7 @@ public class Mth {
|
|||||||
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
||||||
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
||||||
return var11 << 16 | var12 << 8 | var13;
|
return var11 << 16 | var12 << 8 | var13;
|
||||||
}
|
case 2:
|
||||||
case 2 -> {
|
|
||||||
var8 = var5;
|
var8 = var5;
|
||||||
var9 = var2;
|
var9 = var2;
|
||||||
var10 = var7;
|
var10 = var7;
|
||||||
@ -520,8 +518,7 @@ public class Mth {
|
|||||||
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
||||||
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
||||||
return var11 << 16 | var12 << 8 | var13;
|
return var11 << 16 | var12 << 8 | var13;
|
||||||
}
|
case 3:
|
||||||
case 3 -> {
|
|
||||||
var8 = var5;
|
var8 = var5;
|
||||||
var9 = var6;
|
var9 = var6;
|
||||||
var10 = var2;
|
var10 = var2;
|
||||||
@ -529,8 +526,7 @@ public class Mth {
|
|||||||
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
||||||
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
||||||
return var11 << 16 | var12 << 8 | var13;
|
return var11 << 16 | var12 << 8 | var13;
|
||||||
}
|
case 4:
|
||||||
case 4 -> {
|
|
||||||
var8 = var7;
|
var8 = var7;
|
||||||
var9 = var5;
|
var9 = var5;
|
||||||
var10 = var2;
|
var10 = var2;
|
||||||
@ -538,8 +534,7 @@ public class Mth {
|
|||||||
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
||||||
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
||||||
return var11 << 16 | var12 << 8 | var13;
|
return var11 << 16 | var12 << 8 | var13;
|
||||||
}
|
case 5:
|
||||||
case 5 -> {
|
|
||||||
var8 = var2;
|
var8 = var2;
|
||||||
var9 = var5;
|
var9 = var5;
|
||||||
var10 = var6;
|
var10 = var6;
|
||||||
@ -547,7 +542,6 @@ public class Mth {
|
|||||||
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
var12 = clamp((int) (var9 * 255.0F), 0, 255);
|
||||||
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
var13 = clamp((int) (var10 * 255.0F), 0, 255);
|
||||||
return var11 << 16 | var12 << 8 | var13;
|
return var11 << 16 | var12 << 8 | var13;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + var0 + ", " + var1 + ", " + var2);
|
throw new RuntimeException("Something went wrong when converting from HSV to RGB. Input was " + var0 + ", " + var1 + ", " + var2);
|
||||||
}
|
}
|
||||||
|
@ -25,23 +25,22 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
|
|||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
public abstract class DL {
|
public abstract class DL {
|
||||||
protected final File d;
|
protected File d;
|
||||||
protected final URL u;
|
protected URL u;
|
||||||
protected final ChronoLatch latch;
|
protected ChronoLatch latch;
|
||||||
protected final KSet<DownloadFlag> flags;
|
protected KSet<DownloadFlag> flags;
|
||||||
protected MeteredOutputStream o;
|
protected MeteredOutputStream o;
|
||||||
protected DownloadState state;
|
protected DownloadState state;
|
||||||
protected final int timeout;
|
protected int timeout;
|
||||||
protected long size;
|
protected long size;
|
||||||
protected long start;
|
protected long start;
|
||||||
protected long downloaded;
|
protected long downloaded;
|
||||||
protected long currentChunk;
|
protected long currentChunk;
|
||||||
protected long lastChunk;
|
protected long lastChunk;
|
||||||
protected long bps;
|
protected long bps;
|
||||||
protected final int bufferSize;
|
protected int bufferSize;
|
||||||
protected long lastPull;
|
protected long lastPull;
|
||||||
protected DownloadMonitor m;
|
protected DownloadMonitor m;
|
||||||
|
|
||||||
@ -61,7 +60,9 @@ public abstract class DL {
|
|||||||
flags = new KSet<>();
|
flags = new KSet<>();
|
||||||
latch = new ChronoLatch(500);
|
latch = new ChronoLatch(500);
|
||||||
|
|
||||||
flags.addAll(Arrays.asList(downloadFlags));
|
for (DownloadFlag i : downloadFlags) {
|
||||||
|
flags.add(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void monitor(DownloadMonitor m) {
|
public void monitor(DownloadMonitor m) {
|
||||||
|
@ -518,7 +518,9 @@ public abstract class VolmitPlugin extends JavaPlugin implements Listener {
|
|||||||
return super.getDataFolder();
|
return super.getDataFolder();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new File(getDataFolder(), new KList<>(strings).toString(File.separator));
|
File f = new File(getDataFolder(), new KList<>(strings).toString(File.separator));
|
||||||
|
|
||||||
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getDataFolderList(String pre, String[] strings) {
|
public File getDataFolderList(String pre, String[] strings) {
|
||||||
|
@ -206,16 +206,17 @@ public class VolmitSender implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sendProgress(double percent, String thing) {
|
public void sendProgress(double percent, String thing) {
|
||||||
int l = 44;
|
|
||||||
int g;
|
|
||||||
if (percent < 0) {
|
if (percent < 0) {
|
||||||
g = (int) (1D * l);
|
int l = 44;
|
||||||
|
int g = (int) (1D * l);
|
||||||
sendTitle(C.IRIS + thing + " ", 0, 500, 250);
|
sendTitle(C.IRIS + thing + " ", 0, 500, 250);
|
||||||
|
sendActionNoProcessing("" + "" + pulse("#00ff80", "#00373d", 1D) + "<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
||||||
} else {
|
} else {
|
||||||
g = (int) (percent * l);
|
int l = 44;
|
||||||
|
int g = (int) (percent * l);
|
||||||
sendTitle(C.IRIS + thing + " " + C.BLUE + "<font:minecraft:uniform>" + Form.pc(percent, 0), 0, 500, 250);
|
sendTitle(C.IRIS + thing + " " + C.BLUE + "<font:minecraft:uniform>" + Form.pc(percent, 0), 0, 500, 250);
|
||||||
|
sendActionNoProcessing("" + "" + pulse("#00ff80", "#00373d", 1D) + "<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
||||||
}
|
}
|
||||||
sendActionNoProcessing("" + "" + pulse("#00ff80", "#00373d", 1D) + "<underlined> " + Form.repeat(" ", g) + "<reset>" + Form.repeat(" ", l - g));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String pulse(String colorA, String colorB, double speed) {
|
public static String pulse(String colorA, String colorB, double speed) {
|
||||||
@ -387,8 +388,9 @@ public class VolmitSender implements CommandSender {
|
|||||||
|
|
||||||
|
|
||||||
public void sendHeader(String name, int overrideLength) {
|
public void sendHeader(String name, int overrideLength) {
|
||||||
|
int len = overrideLength;
|
||||||
int h = name.length() + 2;
|
int h = name.length() + 2;
|
||||||
String s = Form.repeat(" ", overrideLength - h - 4);
|
String s = Form.repeat(" ", len - h - 4);
|
||||||
String si = Form.repeat("(", 3);
|
String si = Form.repeat("(", 3);
|
||||||
String so = Form.repeat(")", 3);
|
String so = Form.repeat(")", 3);
|
||||||
String sf = "[";
|
String sf = "[";
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
package com.volmit.iris.util.scheduling.jobs;
|
package com.volmit.iris.util.scheduling.jobs;
|
||||||
|
|
||||||
import com.volmit.iris.util.network.DL;
|
import com.volmit.iris.util.network.DL;
|
||||||
|
import com.volmit.iris.util.network.DownloadMonitor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -34,12 +35,15 @@ public class DownloadJob implements Job {
|
|||||||
tw = 1;
|
tw = 1;
|
||||||
cw = 0;
|
cw = 0;
|
||||||
download = new DL.Download(new URL(url), destination, DL.DownloadFlag.CALCULATE_SIZE);
|
download = new DL.Download(new URL(url), destination, DL.DownloadFlag.CALCULATE_SIZE);
|
||||||
download.monitor((state, progress, elapsed, estimated, bps, iobps, size, downloaded, buffer, bufferuse) -> {
|
download.monitor(new DownloadMonitor() {
|
||||||
if (size == -1) {
|
@Override
|
||||||
tw = 1;
|
public void onUpdate(DL.DownloadState state, double progress, long elapsed, long estimated, long bps, long iobps, long size, long downloaded, long buffer, double bufferuse) {
|
||||||
} else {
|
if (size == -1) {
|
||||||
tw = (int) (size / 100);
|
tw = 1;
|
||||||
cw = (int) (downloaded / 100);
|
} else {
|
||||||
|
tw = (int) (size / 100);
|
||||||
|
cw = (int) (downloaded / 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user