mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-18 14:50:57 +00:00
hmmm
This commit is contained in:
+1
-1
@@ -24,7 +24,7 @@ plugins {
|
|||||||
id "de.undercouch.download" version "5.0.1"
|
id "de.undercouch.download" version "5.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
version '2.3.10-1.19.3' // Needs to be version specific
|
version '2.3.11-1.19.3' // Needs to be version specific
|
||||||
def nmsVersion = "1.19.3" //[NMS]
|
def nmsVersion = "1.19.3" //[NMS]
|
||||||
def apiVersion = '1.19'
|
def apiVersion = '1.19'
|
||||||
def specialSourceVersion = '1.11.0' //[NMS]
|
def specialSourceVersion = '1.11.0' //[NMS]
|
||||||
|
|||||||
@@ -48,7 +48,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.NumberFormat;
|
import java.text.NumberFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
@Decree(name = "object", aliases = "o", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris object manipulation")
|
@Decree(name = "object", aliases = "o", origin = DecreeOrigin.PLAYER, studio = true, description = "Iris object manipulation")
|
||||||
public class CommandObject implements DecreeExecutor {
|
public class CommandObject implements DecreeExecutor {
|
||||||
@@ -167,7 +166,7 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Material> sortedMatsList = amounts.keySet().stream().map(BlockData::getMaterial)
|
List<Material> sortedMatsList = amounts.keySet().stream().map(BlockData::getMaterial)
|
||||||
.sorted().collect(Collectors.toList());
|
.sorted().toList();
|
||||||
Set<Material> sortedMats = new TreeSet<>(Comparator.comparingInt(materials::get).reversed());
|
Set<Material> sortedMats = new TreeSet<>(Comparator.comparingInt(materials::get).reversed());
|
||||||
sortedMats.addAll(sortedMatsList);
|
sortedMats.addAll(sortedMatsList);
|
||||||
sender().sendMessage("== Blocks in object ==");
|
sender().sendMessage("== Blocks in object ==");
|
||||||
@@ -216,6 +215,9 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
|
|
||||||
|
|
||||||
Location[] b = WandSVC.getCuboid(player());
|
Location[] b = WandSVC.getCuboid(player());
|
||||||
|
if (b == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
@@ -242,6 +244,9 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
if (WandSVC.isHoldingWand(player())) {
|
if (WandSVC.isHoldingWand(player())) {
|
||||||
Location[] g = WandSVC.getCuboid(player());
|
Location[] g = WandSVC.getCuboid(player());
|
||||||
|
|
||||||
|
if (g == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!here) {
|
if (!here) {
|
||||||
// TODO: WARNING HEIGHT
|
// TODO: WARNING HEIGHT
|
||||||
g[1] = player().getTargetBlock(null, 256).getLocation().clone();
|
g[1] = player().getTargetBlock(null, 256).getLocation().clone();
|
||||||
@@ -265,6 +270,10 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
if (WandSVC.isHoldingIrisWand(player())) {
|
if (WandSVC.isHoldingIrisWand(player())) {
|
||||||
Location[] g = WandSVC.getCuboid(player());
|
Location[] g = WandSVC.getCuboid(player());
|
||||||
|
|
||||||
|
if (g == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!here) {
|
if (!here) {
|
||||||
// TODO: WARNING HEIGHT
|
// TODO: WARNING HEIGHT
|
||||||
g[0] = player().getTargetBlock(null, 256).getLocation().clone();
|
g[0] = player().getTargetBlock(null, 256).getLocation().clone();
|
||||||
@@ -383,6 +392,9 @@ public class CommandObject implements DecreeExecutor {
|
|||||||
Location a1 = b[0].clone();
|
Location a1 = b[0].clone();
|
||||||
Location a2 = b[1].clone();
|
Location a2 = b[1].clone();
|
||||||
Direction d = Direction.closest(player().getLocation().getDirection()).reverse();
|
Direction d = Direction.closest(player().getLocation().getDirection()).reverse();
|
||||||
|
if (d == null) {
|
||||||
|
return; // HOW DID THIS HAPPEN
|
||||||
|
}
|
||||||
a1.add(d.toVector().multiply(amount));
|
a1.add(d.toVector().multiply(amount));
|
||||||
a2.add(d.toVector().multiply(amount));
|
a2.add(d.toVector().multiply(amount));
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
|
|||||||
@@ -162,11 +162,11 @@ public class JigsawEditor implements Listener {
|
|||||||
removeKey(o.getJSONObject(path[0]), s.toArray(new String[0]));
|
removeKey(o.getJSONObject(path[0]), s.toArray(new String[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<JSONObject> getObjectsInArray(JSONObject a, String key) {
|
private List<JSONObject> getObjectsInArray(JSONObject a) { // This gets all the objects in an array that are connectors
|
||||||
KList<JSONObject> o = new KList<>();
|
KList<JSONObject> o = new KList<>();
|
||||||
|
|
||||||
for (int i = 0; i < a.getJSONArray(key).length(); i++) {
|
for (int i = 0; i < a.getJSONArray("connectors").length(); i++) {
|
||||||
o.add(a.getJSONArray(key).getJSONObject(i));
|
o.add(a.getJSONArray("connectors").getJSONObject(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
@@ -185,7 +185,7 @@ public class JigsawEditor implements Listener {
|
|||||||
j.remove("placementOptions"); // otherwise
|
j.remove("placementOptions"); // otherwise
|
||||||
|
|
||||||
// Remove key in all objects in array
|
// Remove key in all objects in array
|
||||||
for (JSONObject i : getObjectsInArray(j, "connectors")) {
|
for (JSONObject i : getObjectsInArray(j)) {
|
||||||
removeKey(i, "rotateConnector");
|
removeKey(i, "rotateConnector");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -277,8 +277,7 @@ public class NoiseExplorerGUI extends JPanel implements MouseWheelListener, List
|
|||||||
Color color = colorMode ? Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n), 1f - (float) n) : Color.getHSBColor(0f, 0f, (float) n);
|
Color color = colorMode ? Color.getHSBColor((float) (n), 1f - (float) (n * n * n * n * n * n), 1f - (float) n) : Color.getHSBColor(0f, 0f, (float) n);
|
||||||
int rgb = color.getRGB();
|
int rgb = color.getRGB();
|
||||||
img.setRGB(xx, z, rgb);
|
img.setRGB(xx, z, rgb);
|
||||||
} catch (Throwable xxx) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -154,12 +154,10 @@ 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(() -> {
|
J.a(() -> PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
||||||
PregenTask.iterateRegion(x, z, (xx, zz) -> {
|
|
||||||
draw(xx, zz, color);
|
draw(xx, zz, color);
|
||||||
J.sleep(3);
|
J.sleep(3);
|
||||||
});
|
}));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(int x, int z, Color color) {
|
public void draw(int x, int z, Color color) {
|
||||||
@@ -168,7 +166,7 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
renderer.func.accept(new Position2(x, z), color);
|
renderer.func.accept(new Position2(x, z), color);
|
||||||
}
|
}
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
|
Iris.error("Failed to draw pregen");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,8 +184,8 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
monitor.close();
|
monitor.close();
|
||||||
J.sleep(3000);
|
J.sleep(3000);
|
||||||
frame.setVisible(false);
|
frame.setVisible(false);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
Iris.error("Error closing pregen gui");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -209,8 +207,8 @@ public class PregeneratorJob implements PregenListener {
|
|||||||
frame.add(renderer);
|
frame.add(renderer);
|
||||||
frame.setSize(1000, 1000);
|
frame.setSize(1000, 1000);
|
||||||
frame.setVisible(true);
|
frame.setVisible(true);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
Iris.error("Error opening pregen gui");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import java.awt.*;
|
|||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
|
|
||||||
@SuppressWarnings("ClassCanBeRecord")
|
|
||||||
public class IrisRenderer {
|
public class IrisRenderer {
|
||||||
private final Engine renderer;
|
private final Engine renderer;
|
||||||
|
|
||||||
|
|||||||
@@ -25,21 +25,22 @@ import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
|||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
// See/update https://app.gitbook.com/@volmitsoftware/s/iris/compatability/papi/
|
// See/update https://app.gitbook.com/@volmitsoftware/s/iris/compatability/papi/
|
||||||
public class IrisPapiExpansion extends PlaceholderExpansion {
|
public class IrisPapiExpansion extends PlaceholderExpansion {
|
||||||
@Override
|
@Override
|
||||||
public String getIdentifier() {
|
public @NotNull String getIdentifier() {
|
||||||
return "iris";
|
return "iris";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAuthor() {
|
public @NotNull String getAuthor() {
|
||||||
return "Volmit Software";
|
return "Volmit Software";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getVersion() {
|
public @NotNull String getVersion() {
|
||||||
return Iris.instance.getDescription().getVersion();
|
return Iris.instance.getDescription().getVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.volmit.iris.core.link;
|
package com.volmit.iris.core.link;
|
||||||
|
|
||||||
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@@ -23,8 +24,8 @@ public class WorldEditLink {
|
|||||||
(int) min.getClass().getDeclaredMethod("getY").invoke(max),
|
(int) min.getClass().getDeclaredMethod("getY").invoke(max),
|
||||||
(int) min.getClass().getDeclaredMethod("getZ").invoke(max)
|
(int) min.getClass().getDeclaredMethod("getZ").invoke(max)
|
||||||
);
|
);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
Iris.error("Failed to get WorldEdit Selection");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ImageResourceLoader extends ResourceLoader<IrisImage> {
|
public class ImageResourceLoader extends ResourceLoader<IrisImage> {
|
||||||
public ImageResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
|
public ImageResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
|
||||||
@@ -66,6 +67,17 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void getPNGFiles(File directory, Set<String> m) {
|
||||||
|
for (File file : directory.listFiles()) {
|
||||||
|
if (file.isFile() && file.getName().endsWith(".png")) {
|
||||||
|
m.add(file.getName().replaceAll("\\Q.png\\E", ""));
|
||||||
|
} else if (file.isDirectory()) {
|
||||||
|
getPNGFiles(file, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String[] getPossibleKeys() {
|
public String[] getPossibleKeys() {
|
||||||
if (possibleKeys != null) {
|
if (possibleKeys != null) {
|
||||||
return possibleKeys;
|
return possibleKeys;
|
||||||
@@ -74,26 +86,31 @@ public class ImageResourceLoader extends ResourceLoader<IrisImage> {
|
|||||||
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
||||||
KSet<String> m = new KSet<>();
|
KSet<String> m = new KSet<>();
|
||||||
|
|
||||||
|
|
||||||
for (File i : getFolders()) {
|
for (File i : getFolders()) {
|
||||||
for (File j : i.listFiles()) {
|
getPNGFiles(i, m);
|
||||||
if (j.isFile() && j.getName().endsWith(".png")) {
|
|
||||||
m.add(j.getName().replaceAll("\\Q.png\\E", ""));
|
|
||||||
} else if (j.isDirectory()) {
|
|
||||||
for (File k : j.listFiles()) {
|
|
||||||
if (k.isFile() && k.getName().endsWith(".png")) {
|
|
||||||
m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.png\\E", ""));
|
|
||||||
} else if (k.isDirectory()) {
|
|
||||||
for (File l : k.listFiles()) {
|
|
||||||
if (l.isFile() && l.getName().endsWith(".png")) {
|
|
||||||
m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.png\\E", ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// for (File i : getFolders()) {
|
||||||
|
// for (File j : i.listFiles()) {
|
||||||
|
// if (j.isFile() && j.getName().endsWith(".png")) {
|
||||||
|
// m.add(j.getName().replaceAll("\\Q.png\\E", ""));
|
||||||
|
// } else if (j.isDirectory()) {
|
||||||
|
// for (File k : j.listFiles()) {
|
||||||
|
// if (k.isFile() && k.getName().endsWith(".png")) {
|
||||||
|
// m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.png\\E", ""));
|
||||||
|
// } else if (k.isDirectory()) {
|
||||||
|
// for (File l : k.listFiles()) {
|
||||||
|
// if (l.isFile() && l.getName().endsWith(".png")) {
|
||||||
|
// m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.png\\E", ""));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
KList<String> v = new KList<>(m);
|
KList<String> v = new KList<>(m);
|
||||||
possibleKeys = v.toArray(new String[0]);
|
possibleKeys = v.toArray(new String[0]);
|
||||||
return possibleKeys;
|
return possibleKeys;
|
||||||
|
|||||||
@@ -369,8 +369,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String ff = g.substring(1).split("\\Q.\\E")[0];
|
return 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() + ")");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject> {
|
public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject> {
|
||||||
|
private String[] possibleKeys;
|
||||||
|
|
||||||
public MatterObjectResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
|
public MatterObjectResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
|
||||||
super(root, idm, folderName, resourceTypeName, IrisMatterObject.class);
|
super(root, idm, folderName, resourceTypeName, IrisMatterObject.class);
|
||||||
loadCache = new KCache<>(this::loadRaw, IrisSettings.get().getPerformance().getObjectLoaderCacheSize());
|
loadCache = new KCache<>(this::loadRaw, IrisSettings.get().getPerformance().getObjectLoaderCacheSize());
|
||||||
@@ -63,6 +65,16 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void findMatFiles(File dir, KSet<String> m) {
|
||||||
|
for (File file : dir.listFiles()) {
|
||||||
|
if (file.isFile() && file.getName().endsWith(".mat")) {
|
||||||
|
m.add(file.getName().replaceAll("\\Q.mat\\E", ""));
|
||||||
|
} else if (file.isDirectory()) {
|
||||||
|
findMatFiles(file, m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String[] getPossibleKeys() {
|
public String[] getPossibleKeys() {
|
||||||
if (possibleKeys != null) {
|
if (possibleKeys != null) {
|
||||||
return possibleKeys;
|
return possibleKeys;
|
||||||
@@ -71,24 +83,8 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
|
|||||||
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
||||||
KSet<String> m = new KSet<>();
|
KSet<String> m = new KSet<>();
|
||||||
|
|
||||||
for (File i : getFolders()) {
|
for (File folder : getFolders()) {
|
||||||
for (File j : i.listFiles()) {
|
findMatFiles(folder, m);
|
||||||
if (j.isFile() && j.getName().endsWith(".mat")) {
|
|
||||||
m.add(j.getName().replaceAll("\\Q.mat\\E", ""));
|
|
||||||
} else if (j.isDirectory()) {
|
|
||||||
for (File k : j.listFiles()) {
|
|
||||||
if (k.isFile() && k.getName().endsWith(".mat")) {
|
|
||||||
m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.mat\\E", ""));
|
|
||||||
} else if (k.isDirectory()) {
|
|
||||||
for (File l : k.listFiles()) {
|
|
||||||
if (l.isFile() && l.getName().endsWith(".mat")) {
|
|
||||||
m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.mat\\E", ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
KList<String> v = new KList<>(m);
|
KList<String> v = new KList<>(m);
|
||||||
@@ -96,6 +92,40 @@ public class MatterObjectResourceLoader extends ResourceLoader<IrisMatterObject>
|
|||||||
return possibleKeys;
|
return possibleKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// public String[] getPossibleKeys() {
|
||||||
|
// if (possibleKeys != null) {
|
||||||
|
// return possibleKeys;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
||||||
|
// KSet<String> m = new KSet<>();
|
||||||
|
//
|
||||||
|
// for (File i : getFolders()) {
|
||||||
|
// for (File j : i.listFiles()) {
|
||||||
|
// if (j.isFile() && j.getName().endsWith(".mat")) {
|
||||||
|
// m.add(j.getName().replaceAll("\\Q.mat\\E", ""));
|
||||||
|
// } else if (j.isDirectory()) {
|
||||||
|
// for (File k : j.listFiles()) {
|
||||||
|
// if (k.isFile() && k.getName().endsWith(".mat")) {
|
||||||
|
// m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.mat\\E", ""));
|
||||||
|
// } else if (k.isDirectory()) {
|
||||||
|
// for (File l : k.listFiles()) {
|
||||||
|
// if (l.isFile() && l.getName().endsWith(".mat")) {
|
||||||
|
// m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.mat\\E", ""));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// KList<String> v = new KList<>(m);
|
||||||
|
// possibleKeys = v.toArray(new String[0]);
|
||||||
|
// return possibleKeys;
|
||||||
|
// }
|
||||||
|
|
||||||
public File findFile(String name) {
|
public File findFile(String name) {
|
||||||
for (File i : getFolders(name)) {
|
for (File i : getFolders(name)) {
|
||||||
for (File j : i.listFiles()) {
|
for (File j : i.listFiles()) {
|
||||||
|
|||||||
@@ -21,13 +21,13 @@ package com.volmit.iris.core.loader;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.engine.object.IrisScript;
|
import com.volmit.iris.engine.object.IrisScript;
|
||||||
import com.volmit.iris.util.collection.KList;
|
|
||||||
import com.volmit.iris.util.collection.KSet;
|
|
||||||
import com.volmit.iris.util.data.KCache;
|
import com.volmit.iris.util.data.KCache;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
||||||
public ScriptResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
|
public ScriptResourceLoader(File root, IrisData idm, String folderName, String resourceTypeName) {
|
||||||
@@ -60,39 +60,70 @@ public class ScriptResourceLoader extends ResourceLoader<IrisScript> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String[] getPossibleKeys() {
|
public String[] getPossibleKeys() {
|
||||||
if (possibleKeys != null) {
|
if (possibleKeys != null) {
|
||||||
return possibleKeys;
|
return possibleKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
||||||
KSet<String> m = new KSet<>();
|
Set<String> keys = new HashSet<>();
|
||||||
|
|
||||||
for (File i : getFolders()) {
|
for (File i : getFolders()) {
|
||||||
for (File j : i.listFiles()) {
|
if (i.isDirectory()) {
|
||||||
if (j.isFile() && j.getName().endsWith(".js")) {
|
keys.addAll(getKeysInDirectory(i));
|
||||||
m.add(j.getName().replaceAll("\\Q.js\\E", ""));
|
|
||||||
} else if (j.isDirectory()) {
|
|
||||||
for (File k : j.listFiles()) {
|
|
||||||
if (k.isFile() && k.getName().endsWith(".js")) {
|
|
||||||
m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.js\\E", ""));
|
|
||||||
} else if (k.isDirectory()) {
|
|
||||||
for (File l : k.listFiles()) {
|
|
||||||
if (l.isFile() && l.getName().endsWith(".js")) {
|
|
||||||
m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.js\\E", ""));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
KList<String> v = new KList<>(m);
|
possibleKeys = keys.toArray(new String[0]);
|
||||||
possibleKeys = v.toArray(new String[0]);
|
|
||||||
return possibleKeys;
|
return possibleKeys;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Set<String> getKeysInDirectory(File directory) {
|
||||||
|
Set<String> keys = new HashSet<>();
|
||||||
|
for (File file : directory.listFiles()) {
|
||||||
|
if (file.isFile() && file.getName().endsWith(".js")) {
|
||||||
|
keys.add(file.getName().replaceAll("\\Q.js\\E", ""));
|
||||||
|
} else if (file.isDirectory()) {
|
||||||
|
keys.addAll(getKeysInDirectory(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
}
|
||||||
|
|
||||||
|
// public String[] getPossibleKeys() {
|
||||||
|
// if (possibleKeys != null) {
|
||||||
|
// return possibleKeys;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// Iris.debug("Building " + resourceTypeName + " Possibility Lists");
|
||||||
|
// KSet<String> m = new KSet<>();
|
||||||
|
//
|
||||||
|
// for (File i : getFolders()) {
|
||||||
|
// for (File j : i.listFiles()) {
|
||||||
|
// if (j.isFile() && j.getName().endsWith(".js")) {
|
||||||
|
// m.add(j.getName().replaceAll("\\Q.js\\E", ""));
|
||||||
|
// } else if (j.isDirectory()) {
|
||||||
|
// for (File k : j.listFiles()) {
|
||||||
|
// if (k.isFile() && k.getName().endsWith(".js")) {
|
||||||
|
// m.add(j.getName() + "/" + k.getName().replaceAll("\\Q.js\\E", ""));
|
||||||
|
// } else if (k.isDirectory()) {
|
||||||
|
// for (File l : k.listFiles()) {
|
||||||
|
// if (l.isFile() && l.getName().endsWith(".js")) {
|
||||||
|
// m.add(j.getName() + "/" + k.getName() + "/" + l.getName().replaceAll("\\Q.js\\E", ""));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// KList<String> v = new KList<>(m);
|
||||||
|
// possibleKeys = v.toArray(new String[0]);
|
||||||
|
// return possibleKeys;
|
||||||
|
// }
|
||||||
|
|
||||||
public File findFile(String name) {
|
public File findFile(String name) {
|
||||||
for (File i : getFolders(name)) {
|
for (File i : getFolders(name)) {
|
||||||
for (File j : i.listFiles()) {
|
for (File j : i.listFiles()) {
|
||||||
|
|||||||
@@ -1,159 +0,0 @@
|
|||||||
/*
|
|
||||||
* Iris is a World Generator for Minecraft Bukkit Servers
|
|
||||||
* Copyright (c) 2022 Arcane Arts (Volmit Software)
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.volmit.iris.core.nms;
|
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public enum NMSVersion {
|
|
||||||
R1_19_1,
|
|
||||||
R1_18_2,
|
|
||||||
R1_18,
|
|
||||||
R1_17,
|
|
||||||
R1_16,
|
|
||||||
R1_15,
|
|
||||||
R1_14,
|
|
||||||
R1_13,
|
|
||||||
R1_13_1,
|
|
||||||
R1_12,
|
|
||||||
R1_11,
|
|
||||||
R1_10,
|
|
||||||
R1_9_4,
|
|
||||||
R1_9_2,
|
|
||||||
R1_8;
|
|
||||||
|
|
||||||
public static NMSVersion getMinimum() {
|
|
||||||
return values()[values().length - 1];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NMSVersion getMaximum() {
|
|
||||||
return values()[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static NMSVersion current() {
|
|
||||||
if (tryVersion("1_8_R3")) {
|
|
||||||
return R1_8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_9_R1")) {
|
|
||||||
return R1_9_2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_9_R2")) {
|
|
||||||
return R1_9_4;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_10_R1")) {
|
|
||||||
return R1_10;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_11_R1")) {
|
|
||||||
return R1_11;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_12_R1")) {
|
|
||||||
return R1_12;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_13_R1")) {
|
|
||||||
return R1_13;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_13_R2")) {
|
|
||||||
return R1_13_1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_14_R1")) {
|
|
||||||
return R1_14;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_15_R1")) {
|
|
||||||
return R1_15;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_16_R1")) {
|
|
||||||
return R1_16;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_17_R1")) {
|
|
||||||
return R1_17;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tryVersion("1_18_R1")) {
|
|
||||||
return R1_18;
|
|
||||||
}
|
|
||||||
if (tryVersion("1_18_R2")) {
|
|
||||||
return R1_18_2;
|
|
||||||
}
|
|
||||||
if (tryVersion("1_19_R1")) {
|
|
||||||
return R1_19_1;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static boolean tryVersion(String v) {
|
|
||||||
try {
|
|
||||||
Class.forName("org.bukkit.craftbukkit.v" + v + ".CraftWorld");
|
|
||||||
return true;
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NMSVersion> getAboveInclusive() {
|
|
||||||
List<NMSVersion> n = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NMSVersion i : values()) {
|
|
||||||
if (i.ordinal() >= ordinal()) {
|
|
||||||
n.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NMSVersion> betweenInclusive(NMSVersion other) {
|
|
||||||
List<NMSVersion> n = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NMSVersion i : values()) {
|
|
||||||
if (i.ordinal() <= Math.max(other.ordinal(), ordinal()) && i.ordinal() >= Math.min(ordinal(), other.ordinal())) {
|
|
||||||
n.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<NMSVersion> getBelowInclusive() {
|
|
||||||
List<NMSVersion> n = new ArrayList<>();
|
|
||||||
|
|
||||||
for (NMSVersion i : values()) {
|
|
||||||
if (i.ordinal() <= ordinal()) {
|
|
||||||
n.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return n;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -38,8 +38,8 @@ public class WandSelection {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void draw() {
|
public void draw() {
|
||||||
double accuracy = M.lerpInverse(0, 64 * 64, p.getLocation().distanceSquared(c.getCenter()));
|
double accuracy;
|
||||||
double dist = M.lerp(0.125, 3.5, accuracy);
|
double dist;
|
||||||
|
|
||||||
for (double i = c.getLowerX() - 1; i < c.getUpperX() + 1; i += 0.25) {
|
for (double i = c.getLowerX() - 1; i < c.getUpperX() + 1; i += 0.25) {
|
||||||
for (double j = c.getLowerY() - 1; j < c.getUpperY() + 1; j += 0.25) {
|
for (double j = c.getLowerY() - 1; j < c.getUpperY() + 1; j += 0.25) {
|
||||||
|
|||||||
Reference in New Issue
Block a user