Optimization Overhaul

This commit is contained in:
Brian Neumann-Fopiano 2022-11-12 13:31:39 -08:00
parent 85fbbeca9d
commit af1a03cb67
505 changed files with 21100 additions and 22808 deletions

View File

@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.3.7-1.19.2' // Needs to be version specific
version '2.3.8-1.19.2' // Needs to be version specific
def nmsVersion = "1.19.2" //[NMS]
def apiVersion = '1.19'
def specialSourceVersion = '1.11.0' //[NMS]

View File

@ -187,6 +187,7 @@ public class Iris extends VolmitPlugin implements Listener {
}
}
}
public static File getCached(String name, String url) {
String h = IO.hash(name + "@" + url);
File f = Iris.instance.getDataFile("cache", h.substring(0, 2), h.substring(3, 5), h);
@ -386,6 +387,44 @@ public class Iris extends VolmitPlugin implements Listener {
}
}
public static void dump() {
try {
File fi = Iris.instance.getDataFile("dump", "td-" + new java.sql.Date(M.ms()) + ".txt");
FileOutputStream fos = new FileOutputStream(fi);
Map<Thread, StackTraceElement[]> f = Thread.getAllStackTraces();
PrintWriter pw = new PrintWriter(fos);
for (Thread i : f.keySet()) {
pw.println("========================================");
pw.println("Thread: '" + i.getName() + "' ID: " + i.getId() + " STATUS: " + i.getState().name());
for (StackTraceElement j : f.get(i)) {
pw.println(" @ " + j.toString());
}
pw.println("========================================");
pw.println();
pw.println();
}
pw.close();
System.out.println("DUMPED! See " + fi.getAbsolutePath());
} catch (Throwable e) {
e.printStackTrace();
}
}
public static void panic() {
EnginePanic.panic();
}
public static void addPanic(String s, String v) {
EnginePanic.add(s, v);
}
private static void fixShading() {
ShadeFix.fix(ComponentSerializer.class);
}
private void enable() {
instance = this;
services = new KMap<>();
@ -423,8 +462,8 @@ public class Iris extends VolmitPlugin implements Listener {
FileConfiguration fc = new YamlConfiguration();
try {
fc.load(new File("bukkit.yml"));
searching: for(String i : fc.getKeys(true))
{
searching:
for (String i : fc.getKeys(true)) {
if (i.startsWith("worlds.") && i.endsWith(".generator")) {
String worldName = i.split("\\Q.\\E")[1];
String generator = IrisSettings.get().getGenerator().getDefaultWorldType();
@ -436,10 +475,8 @@ public class Iris extends VolmitPlugin implements Listener {
continue;
}
for(World j : Bukkit.getWorlds())
{
if(j.getName().equals(worldName))
{
for (World j : Bukkit.getWorlds()) {
if (j.getName().equals(worldName)) {
continue searching;
}
}
@ -488,44 +525,10 @@ public class Iris extends VolmitPlugin implements Listener {
}
}
public static void dump() {
try {
File fi = Iris.instance.getDataFile("dump", "td-" + new java.sql.Date(M.ms()) + ".txt");
FileOutputStream fos = new FileOutputStream(fi);
Map<Thread, StackTraceElement[]> f = Thread.getAllStackTraces();
PrintWriter pw = new PrintWriter(fos);
for(Thread i : f.keySet()) {
pw.println("========================================");
pw.println("Thread: '" + i.getName() + "' ID: " + i.getId() + " STATUS: " + i.getState().name());
for(StackTraceElement j : f.get(i)) {
pw.println(" @ " + j.toString());
}
pw.println("========================================");
pw.println();
pw.println();
}
pw.close();
System.out.println("DUMPED! See " + fi.getAbsolutePath());
} catch(Throwable e) {
e.printStackTrace();
}
}
public void postShutdown(Runnable r) {
postShutdown.add(r);
}
public static void panic() {
EnginePanic.panic();
}
public static void addPanic(String s, String v) {
EnginePanic.add(s, v);
}
public void onEnable() {
enable();
super.onEnable();
@ -542,10 +545,6 @@ public class Iris extends VolmitPlugin implements Listener {
super.onDisable();
}
private static void fixShading() {
ShadeFix.fix(ComponentSerializer.class);
}
private void setupPapi() {
if (Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null) {
new IrisPapiExpansion().register();
@ -729,7 +728,8 @@ public class Iris extends VolmitPlugin implements Listener {
JsonObject json = JsonParser.parseReader(r).getAsJsonObject();
if (json.has("version"))
version = json.get("version").getAsString();
} catch(IOException | JsonParseException ignored) { }
} catch (IOException | JsonParseException ignored) {
}
Iris.info(" " + dimName + " v" + version);
}
}

View File

@ -50,6 +50,57 @@ public class IrisSettings {
};
}
public static IrisSettings get() {
if (settings != null) {
return settings;
}
settings = new IrisSettings();
File s = Iris.instance.getDataFile("settings.json");
if (!s.exists()) {
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch (JSONException | IOException e) {
e.printStackTrace();
Iris.reportError(e);
}
} else {
try {
String ss = IO.readAll(s);
settings = new Gson().fromJson(ss, IrisSettings.class);
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch (IOException e) {
e.printStackTrace();
}
} catch (Throwable ee) {
// Iris.reportError(ee); causes a self-reference & stackoverflow
Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage());
}
}
return settings;
}
public static void invalidate() {
synchronized (settings) {
settings = null;
}
}
public void forceSave() {
File s = Iris.instance.getDataFile("settings.json");
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch (JSONException | IOException e) {
e.printStackTrace();
Iris.reportError(e);
}
}
@Data
public static class IrisSettingsAutoconfiguration {
public boolean configureSpigotTimeoutTime = true;
@ -132,55 +183,4 @@ public class IrisSettings {
public boolean disableTimeAndWeather = true;
public boolean autoStartDefaultStudio = false;
}
public static IrisSettings get() {
if(settings != null) {
return settings;
}
settings = new IrisSettings();
File s = Iris.instance.getDataFile("settings.json");
if(!s.exists()) {
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch(JSONException | IOException e) {
e.printStackTrace();
Iris.reportError(e);
}
} else {
try {
String ss = IO.readAll(s);
settings = new Gson().fromJson(ss, IrisSettings.class);
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch(IOException e) {
e.printStackTrace();
}
} catch(Throwable ee) {
// Iris.reportError(ee); causes a self-reference & stackoverflow
Iris.error("Configuration Error in settings.json! " + ee.getClass().getSimpleName() + ": " + ee.getMessage());
}
}
return settings;
}
public static void invalidate() {
synchronized(settings) {
settings = null;
}
}
public void forceSave() {
File s = Iris.instance.getDataFile("settings.json");
try {
IO.writeAll(s, new JSONObject(new Gson().toJson(settings)).toString(4));
} catch(JSONException | IOException e) {
e.printStackTrace();
Iris.reportError(e);
}
}
}

View File

@ -28,7 +28,6 @@ import com.volmit.iris.util.decree.annotations.Decree;
import com.volmit.iris.util.decree.annotations.Param;
import com.volmit.iris.util.decree.specialhandlers.ObjectHandler;
import com.volmit.iris.util.format.C;
import org.bukkit.generator.structure.StructureType;
@Decree(name = "find", origin = DecreeOrigin.PLAYER, description = "Iris Find commands", aliases = "goto")
public class CommandFind implements DecreeExecutor {

View File

@ -66,8 +66,7 @@ public class JigsawEditor implements Listener {
}
editors.put(player, this);
if(object == null)
{
if (object == null) {
throw new RuntimeException("Object is null! " + piece.getObject());
}
this.object = object;
@ -152,10 +151,8 @@ public class JigsawEditor implements Listener {
}
}
private void removeKey(JSONObject o, String... path)
{
if(path.length == 1)
{
private void removeKey(JSONObject o, String... path) {
if (path.length == 1) {
o.remove(path[0]);
return;
}
@ -165,12 +162,10 @@ public class JigsawEditor implements Listener {
removeKey(o.getJSONObject(path[0]), s.toArray(new String[0]));
}
private List<JSONObject> getObjectsInArray(JSONObject a, String key)
{
private List<JSONObject> getObjectsInArray(JSONObject a, String key) {
KList<JSONObject> o = new KList<>();
for(int i = 0; i < a.getJSONArray(key).length(); i++)
{
for (int i = 0; i < a.getJSONArray(key).length(); i++) {
o.add(a.getJSONArray(key).getJSONObject(i));
}
@ -190,8 +185,7 @@ public class JigsawEditor implements Listener {
j.remove("placementOptions"); // otherwise
// Remove key in all objects in array
for(JSONObject i : getObjectsInArray(j, "connectors"))
{
for (JSONObject i : getObjectsInArray(j, "connectors")) {
removeKey(i, "rotateConnector");
}

View File

@ -62,12 +62,12 @@ public class PregeneratorJob implements PregenListener {
private final IrisPregenerator pregenerator;
private final Position2 min;
private final Position2 max;
private final ChronoLatch cl = new ChronoLatch(TimeUnit.MINUTES.toMillis(1));
private final Engine engine;
private JFrame frame;
private PregenRenderer renderer;
private int rgc = 0;
private final ChronoLatch cl = new ChronoLatch(TimeUnit.MINUTES.toMillis(1));
private String[] info;
private final Engine engine;
public PregeneratorJob(PregenTask task, PregeneratorMethod method, Engine engine) {
this.engine = engine;
@ -93,10 +93,6 @@ public class PregeneratorJob implements PregenListener {
J.a(this.pregenerator::start, 20);
}
public Mantle getMantle() {
return pregenerator.getMantle();
}
public static boolean shutdownInstance() {
if (instance == null) {
return false;
@ -143,6 +139,10 @@ public class PregeneratorJob implements PregenListener {
return Color.RED;
}
public Mantle getMantle() {
return pregenerator.getMantle();
}
public PregeneratorJob onProgress(Consumer<Double> c) {
onProgress.add(c);
return this;

View File

@ -212,12 +212,18 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
BiFunction<Double, Double, Integer> colorFunction = (d, dx) -> Color.black.getRGB();
switch (currentType) {
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> engine.getComplex().getTrueBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case BIOME_LAND -> colorFunction = (x, z) -> engine.getComplex().getLandBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case BIOME_SEA -> colorFunction = (x, z) -> engine.getComplex().getSeaBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case REGION -> colorFunction = (x, z) -> engine.getComplex().getRegionStream().get(x, z).getColor(engine.getComplex(), currentType).getRGB();
case CAVE_LAND -> colorFunction = (x, z) -> engine.getComplex().getCaveBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(engine.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD ->
colorFunction = (x, z) -> engine.getComplex().getTrueBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case BIOME_LAND ->
colorFunction = (x, z) -> engine.getComplex().getLandBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case BIOME_SEA ->
colorFunction = (x, z) -> engine.getComplex().getSeaBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case REGION ->
colorFunction = (x, z) -> engine.getComplex().getRegionStream().get(x, z).getColor(engine.getComplex(), currentType).getRGB();
case CAVE_LAND ->
colorFunction = (x, z) -> engine.getComplex().getCaveBiomeStream().get(x, z).getColor(engine, currentType).getRGB();
case HEIGHT ->
colorFunction = (x, z) -> Color.getHSBColor(engine.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
}
return colorFunction.apply(wx, wz);
@ -427,13 +433,9 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
if (engine.isClosed()) {
EventQueue.invokeLater(() -> {
try
{
try {
setVisible(false);
}
catch(Throwable e)
{
} catch (Throwable e) {
}
});
@ -733,7 +735,8 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
IrisComplex complex = engine.getComplex();
File r = null;
switch (currentType) {
case BIOME, LAYER_LOAD, DECORATOR_LOAD, OBJECT_LOAD, HEIGHT -> r = complex.getTrueBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case BIOME, LAYER_LOAD, DECORATOR_LOAD, OBJECT_LOAD, HEIGHT ->
r = complex.getTrueBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case BIOME_LAND -> r = complex.getLandBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case BIOME_SEA -> r = complex.getSeaBiomeStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();
case REGION -> r = complex.getRegionStream().get(getWorldX(hx), getWorldZ(hz)).openInVSCode();

View File

@ -38,12 +38,18 @@ public class IrisRenderer {
BiFunction<Double, Double, Integer> colorFunction = (d, dx) -> Color.black.getRGB();
switch (currentType) {
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD -> colorFunction = (x, z) -> renderer.getComplex().getTrueBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case BIOME_LAND -> colorFunction = (x, z) -> renderer.getComplex().getLandBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case BIOME_SEA -> colorFunction = (x, z) -> renderer.getComplex().getSeaBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case REGION -> colorFunction = (x, z) -> renderer.getComplex().getRegionStream().get(x, z).getColor(renderer.getComplex(), currentType).getRGB();
case CAVE_LAND -> colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case HEIGHT -> colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
case BIOME, DECORATOR_LOAD, OBJECT_LOAD, LAYER_LOAD ->
colorFunction = (x, z) -> renderer.getComplex().getTrueBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case BIOME_LAND ->
colorFunction = (x, z) -> renderer.getComplex().getLandBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case BIOME_SEA ->
colorFunction = (x, z) -> renderer.getComplex().getSeaBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case REGION ->
colorFunction = (x, z) -> renderer.getComplex().getRegionStream().get(x, z).getColor(renderer.getComplex(), currentType).getRGB();
case CAVE_LAND ->
colorFunction = (x, z) -> renderer.getComplex().getCaveBiomeStream().get(x, z).getColor(renderer, currentType).getRGB();
case HEIGHT ->
colorFunction = (x, z) -> Color.getHSBColor(renderer.getComplex().getHeightStream().get(x, z).floatValue(), 100, 100).getRGB();
}
double x, z;

View File

@ -17,7 +17,8 @@ public class ItemAdderDataProvider extends ExternalDataProvider {
}
@Override
public void init() { }
public void init() {
}
@Override
public BlockData getBlockData(NamespacedKey blockId) throws MissingResourceException {

View File

@ -50,10 +50,8 @@ public class MythicMobsLink {
/**
* Spawn a mythic mob at this location
*
* @param mob
* The mob
* @param location
* The location
* @param mob The mob
* @param location The location
* @return The mob, or null if it can't be spawned
*/
public @Nullable
@ -105,7 +103,8 @@ public class MythicMobsLink {
Method getMobNames = mobManager.getClass().getDeclaredMethod("getMobNames");
mobs = (Collection<String>) getMobNames.invoke(mobManager);
return mobs;
} catch(ClassNotFoundException | NoSuchMethodException | InvocationTargetException | IllegalAccessException e) {
} catch (ClassNotFoundException | NoSuchMethodException | InvocationTargetException |
IllegalAccessException e) {
e.printStackTrace();
}
}

View File

@ -46,7 +46,9 @@ public class OraxenDataProvider extends ExternalDataProvider {
private Map<String, MechanicFactory> factories;
public OraxenDataProvider() { super("Oraxen"); }
public OraxenDataProvider() {
super("Oraxen");
}
@Override
public void init() {
@ -87,7 +89,8 @@ public class OraxenDataProvider extends ExternalDataProvider {
NamespacedKey key = new NamespacedKey("oraxen", name);
if (getBlockData(key) != null)
names.add(key);
} catch(MissingResourceException ignored) { }
} catch (MissingResourceException ignored) {
}
}
return names.toArray(new NamespacedKey[0]);

View File

@ -5,10 +5,8 @@ import org.bukkit.World;
import org.bukkit.entity.Player;
public class WorldEditLink {
public static Cuboid getSelection(Player p)
{
try
{
public static Cuboid getSelection(Player p) {
try {
Object instance = Class.forName("com.sk89q.worldedit.WorldEdit").getDeclaredMethod("getInstance").invoke(null);
Object sessionManager = instance.getClass().getDeclaredMethod("getSessionManager").invoke(instance);
Object player = Class.forName("com.sk89q.worldedit.bukkit.BukkitAdapter").getDeclaredMethod("adapt", Player.class).invoke(null, p);
@ -25,10 +23,7 @@ public class WorldEditLink {
(int) min.getClass().getDeclaredMethod("getY").invoke(max),
(int) min.getClass().getDeclaredMethod("getZ").invoke(max)
);
}
catch(Throwable e)
{
} catch (Throwable e) {
}

View File

@ -113,6 +113,7 @@ public class IrisData implements ExclusionStrategy, TypeAdapterFactory {
public static IrisObject loadAnyObject(String key) {
return loadAny(key, (dm) -> dm.getObjectLoader().load(key, false));
}
public static IrisMatterObject loadAnyMatter(String key) {
return loadAny(key, (dm) -> dm.getMatterLoader().load(key, false));
}

View File

@ -55,12 +55,12 @@ import java.util.zip.GZIPOutputStream;
public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
public static final AtomicDouble tlt = new AtomicDouble(0);
private static final int CACHE_SIZE = 100000;
protected final AtomicReference<KList<File>> folderCache;
protected KSet<String> firstAccess;
protected File root;
protected String folderName;
protected String resourceTypeName;
protected KCache<String, T> loadCache;
protected final AtomicReference<KList<File>> folderCache;
protected Class<? extends T> objectClass;
protected String cname;
protected String[] possibleKeys = null;
@ -312,8 +312,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
return loadCache.get(name);
}
public void loadFirstAccess(Engine engine) throws IOException
{
public void loadFirstAccess(Engine engine) throws IOException {
String id = "DIM" + Math.abs(engine.getSeedManager().getSeed() + engine.getDimension().getVersion() + engine.getDimension().getLoadKey().hashCode());
File file = Iris.instance.getDataFile("prefetch/" + id + "/" + Math.abs(getFolderName().hashCode()) + ".ipfch");
@ -336,6 +335,7 @@ public class ResourceLoader<T extends IrisRegistrant> implements MeteredCache {
Iris.info("Loading " + s.size() + " prefetch " + getFolderName());
loadAllParallel(s);
}
public void saveFirstAccess(Engine engine) throws IOException {
String id = "DIM" + Math.abs(engine.getSeedManager().getSeed() + engine.getDimension().getVersion() + engine.getDimension().getLoadKey().hashCode());
File file = Iris.instance.getDataFile("prefetch/" + id + "/" + Math.abs(getFolderName().hashCode()) + ".ipfch");

View File

@ -56,6 +56,7 @@ public interface INMSBinding {
String getTrueBiomeBaseKey(Location location);
Object getCustomBiomeBaseFor(String mckey);
Object getCustomBiomeBaseHolderFor(String mckey);
int getBiomeBaseIdForKey(String key);

View File

@ -49,21 +49,6 @@ public class CustomBiomeSource extends BiomeSource {
this.customBiomes = fillCustomBiomes(biomeCustomRegistry, engine);
}
private KMap<String, Holder<Biome>> fillCustomBiomes(Registry<Biome> customRegistry, Engine engine) {
KMap<String, Holder<Biome>> m = new KMap<>();
for(IrisBiome i : engine.getAllBiomes()) {
if(i.isCustom()) {
for(IrisBiomeCustom j : i.getCustomDerivitives()) {
m.put(j.getId(), customRegistry.getHolder(customRegistry.getResourceKey(customRegistry
.get(new ResourceLocation(engine.getDimension().getLoadKey() + ":" + j.getId()))).get()).get());
}
}
}
return m;
}
private static List<Holder<Biome>> getAllBiomes(Registry<Biome> customRegistry, Registry<Biome> registry, Engine engine) {
List<Holder<Biome>> b = new ArrayList<>();
@ -81,10 +66,6 @@ public class CustomBiomeSource extends BiomeSource {
return b;
}
private RegistryAccess registry() {
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
}
private static Object getFor(Class<?> type, Object source) {
Object o = fieldFor(type, source);
@ -99,7 +80,6 @@ public class CustomBiomeSource extends BiomeSource {
return fieldForClass(returns, in.getClass(), in);
}
private static Object invokeFor(Class<?> returns, Object in) {
for (Method i : in.getClass().getMethods()) {
if (i.getReturnType().equals(returns)) {
@ -132,6 +112,25 @@ public class CustomBiomeSource extends BiomeSource {
return null;
}
private KMap<String, Holder<Biome>> fillCustomBiomes(Registry<Biome> customRegistry, Engine engine) {
KMap<String, Holder<Biome>> m = new KMap<>();
for (IrisBiome i : engine.getAllBiomes()) {
if (i.isCustom()) {
for (IrisBiomeCustom j : i.getCustomDerivitives()) {
m.put(j.getId(), customRegistry.getHolder(customRegistry.getResourceKey(customRegistry
.get(new ResourceLocation(engine.getDimension().getLoadKey() + ":" + j.getId()))).get()).get());
}
}
}
return m;
}
private RegistryAccess registry() {
return registryAccess.aquire(() -> (RegistryAccess) getFor(RegistryAccess.Frozen.class, ((CraftServer) Bukkit.getServer()).getHandle().getServer()));
}
@Override
protected Codec<? extends BiomeSource> codec() {
throw new UnsupportedOperationException("Not supported");

View File

@ -74,6 +74,56 @@ public class NMSBinding19_2 implements INMSBinding {
private final AtomicCache<Method> byIdRef = new AtomicCache<>();
private Field biomeStorageCache = null;
private static Object getFor(Class<?> type, Object source) {
Object o = fieldFor(type, source);
if (o != null) {
return o;
}
return invokeFor(type, source);
}
private static Object invokeFor(Class<?> returns, Object in) {
for (Method i : in.getClass().getMethods()) {
if (i.getReturnType().equals(returns)) {
i.setAccessible(true);
try {
Iris.debug("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName() + "()");
return i.invoke(in);
} catch (Throwable e) {
e.printStackTrace();
}
}
}
return null;
}
private static Object fieldFor(Class<?> returns, Object in) {
return fieldForClass(returns, in.getClass(), in);
}
@SuppressWarnings("unchecked")
private static <T> T fieldForClass(Class<T> returnType, Class<?> sourceType, Object in) {
for (Field i : sourceType.getDeclaredFields()) {
if (i.getType().equals(returnType)) {
i.setAccessible(true);
try {
Iris.debug("[NMS] Found " + returnType.getSimpleName() + " in " + sourceType.getSimpleName() + "." + i.getName());
return (T) i.get(in);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return null;
}
private static Class<?> getClassType(Class<?> type, int ordinal) {
return type.getDeclaredClasses()[ordinal];
}
@Override
public boolean hasTile(Location l) {
return ((CraftWorld) l.getWorld()).getHandle().getBlockEntity(new BlockPos(l.getBlockX(), l.getBlockY(), l.getBlockZ()), false) != null;
@ -187,6 +237,7 @@ public class NMSBinding19_2 implements INMSBinding {
public Object getCustomBiomeBaseFor(String mckey) {
return getCustomBiomeRegistry().get(new ResourceLocation(mckey));
}
@Override
public Object getCustomBiomeBaseHolderFor(String mckey) {
return getCustomBiomeRegistry().getHolder(getTrueBiomeBaseId(getCustomBiomeRegistry().get(new ResourceLocation(mckey)))).get();
@ -390,63 +441,11 @@ public class NMSBinding19_2 implements INMSBinding {
if (b.isCustom()) {
chunk.setBiome(x, y, z, getCustomBiomeRegistry().getHolder(b.getBiomeId()).get());
c.getAndIncrement();
}
else {
} else {
chunk.setBiome(x, y, z, (Holder<net.minecraft.world.level.biome.Biome>) getBiomeBase(e.getWorld(), b.getBiome()));
r.getAndIncrement();
}
}
});
}
private static Object getFor(Class<?> type, Object source) {
Object o = fieldFor(type, source);
if(o != null) {
return o;
}
return invokeFor(type, source);
}
private static Object invokeFor(Class<?> returns, Object in) {
for(Method i : in.getClass().getMethods()) {
if(i.getReturnType().equals(returns)) {
i.setAccessible(true);
try {
Iris.debug("[NMS] Found " + returns.getSimpleName() + " in " + in.getClass().getSimpleName() + "." + i.getName() + "()");
return i.invoke(in);
} catch(Throwable e) {
e.printStackTrace();
}
}
}
return null;
}
private static Object fieldFor(Class<?> returns, Object in) {
return fieldForClass(returns, in.getClass(), in);
}
@SuppressWarnings("unchecked")
private static <T> T fieldForClass(Class<T> returnType, Class<?> sourceType, Object in) {
for(Field i : sourceType.getDeclaredFields()) {
if(i.getType().equals(returnType)) {
i.setAccessible(true);
try {
Iris.debug("[NMS] Found " + returnType.getSimpleName() + " in " + sourceType.getSimpleName() + "." + i.getName());
return (T) i.get(in);
} catch(IllegalAccessException e) {
e.printStackTrace();
}
}
}
return null;
}
private static Class<?> getClassType(Class<?> type, int ordinal) {
return type.getDeclaredClasses()[ordinal];
}
}

View File

@ -54,8 +54,7 @@ public class IrisPack {
* Create an iris pack backed by a data folder
* the data folder is assumed to be in the Iris/packs/NAME folder
*
* @param name
* the name
* @param name the name
*/
public IrisPack(String name) {
this(packsPack(name));
@ -64,8 +63,7 @@ public class IrisPack {
/**
* Create an iris pack backed by a data folder
*
* @param folder
* the folder of the pack. Must be a directory
* @param folder the folder of the pack. Must be a directory
*/
public IrisPack(File folder) {
this.folder = folder;
@ -84,13 +82,10 @@ public class IrisPack {
/**
* Create a new pack from the input url
*
* @param sender
* the sender
* @param url
* the url, or name, or really anything see IrisPackRepository.from(String)
* @param sender the sender
* @param url the url, or name, or really anything see IrisPackRepository.from(String)
* @return the iris pack
* @throws IrisException
* fails
* @throws IrisException fails
*/
public static Future<IrisPack> from(VolmitSender sender, String url) throws IrisException {
IrisPackRepository repo = IrisPackRepository.from(url);
@ -108,13 +103,10 @@ public class IrisPack {
/**
* Create a pack from a repo
*
* @param sender
* the sender
* @param repo
* the repo
* @param sender the sender
* @param repo the repo
* @return the pack
* @throws MalformedURLException
* shit happens
* @throws MalformedURLException shit happens
*/
public static Future<IrisPack> from(VolmitSender sender, IrisPackRepository repo) throws MalformedURLException {
CompletableFuture<IrisPack> pack = new CompletableFuture<>();
@ -127,11 +119,9 @@ public class IrisPack {
/**
* Create a blank pack with a given name
*
* @param name
* the name of the pack
* @param name the name of the pack
* @return the pack
* @throws IrisException
* if the pack already exists or another error
* @throws IrisException if the pack already exists or another error
*/
public static IrisPack blank(String name) throws IrisException {
File f = packsPack(name);
@ -159,8 +149,7 @@ public class IrisPack {
/**
* Get a packs pack folder for a name. Such that overworld would resolve as Iris/packs/overworld
*
* @param name
* the name
* @param name the name
* @return the file path
*/
public static File packsPack(String name) {
@ -243,8 +232,7 @@ public class IrisPack {
/**
* Install this pack into a world
*
* @param world
* the world to install into (world/iris/pack)
* @param world the world to install into (world/iris/pack)
* @return the installed pack
*/
public IrisPack install(World world) throws IrisException {
@ -254,8 +242,7 @@ public class IrisPack {
/**
* Install this pack into a world
*
* @param world
* the world to install into (world/iris/pack)
* @param world the world to install into (world/iris/pack)
* @return the installed pack
*/
public IrisPack install(IrisWorld world) throws IrisException {
@ -265,8 +252,7 @@ public class IrisPack {
/**
* Install this pack into a world
*
* @param folder
* the folder to install this pack into
* @param folder the folder to install this pack into
* @return the installed pack
*/
public IrisPack install(File folder) throws IrisException {
@ -289,8 +275,7 @@ public class IrisPack {
* Create a new pack using this pack as a template. The new pack will be renamed & have a renamed dimension
* to match it.
*
* @param newName
* the new pack name
* @param newName the new pack name
* @return the new IrisPack
*/
public IrisPack install(String newName) throws IrisException {
@ -345,8 +330,7 @@ public class IrisPack {
/**
* Find all files in this pack with the given extension
*
* @param fileExtension
* the extension
* @param fileExtension the extension
* @return the list of files
*/
public KList<File> collectFiles(String fileExtension) {

View File

@ -174,7 +174,8 @@ public class IrisPregenerator {
J.sleep(50);
}
generator.generateChunk(xx, zz, listener);});
generator.generateChunk(xx, zz, listener);
});
}
if (hit) {

View File

@ -21,8 +21,7 @@ import java.io.File;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
public class LazyPregenerator extends Thread implements Listener
{
public class LazyPregenerator extends Thread implements Listener {
private final LazyPregenJob job;
private final File destination;
private final int maxPosition;
@ -30,11 +29,11 @@ public class LazyPregenerator extends Thread implements Listener
private final long rate;
private final ChronoLatch latch;
public LazyPregenerator(LazyPregenJob job, File destination)
{
public LazyPregenerator(LazyPregenJob job, File destination) {
this.job = job;
this.destination = destination;
this.maxPosition = new Spiraler(job.getRadiusBlocks() * 2, job.getRadiusBlocks() * 2, (x, z) -> {}).count();
this.maxPosition = new Spiraler(job.getRadiusBlocks() * 2, job.getRadiusBlocks() * 2, (x, z) -> {
}).count();
this.world = Bukkit.getWorld(job.getWorld());
this.rate = Math.round((1D / (job.chunksPerMinute / 60D)) * 1000D);
this.latch = new ChronoLatch(60000);
@ -44,16 +43,30 @@ public class LazyPregenerator extends Thread implements Listener
this(new Gson().fromJson(IO.readAll(file), LazyPregenJob.class), file);
}
public static void loadLazyGenerators() {
for (World i : Bukkit.getWorlds()) {
File lazygen = new File(i.getWorldFolder(), "lazygen.json");
if (lazygen.exists()) {
try {
LazyPregenerator p = new LazyPregenerator(lazygen);
p.start();
Iris.info("Started Lazy Pregenerator: " + p.job);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
@EventHandler
public void on(WorldUnloadEvent e)
{
public void on(WorldUnloadEvent e) {
if (e.getWorld().equals(world)) {
interrupt();
}
}
public void run()
{
public void run() {
while (!interrupted()) {
J.sleep(rate);
tick();
@ -67,30 +80,21 @@ public class LazyPregenerator extends Thread implements Listener
}
public void tick() {
if(latch.flip())
{
if (latch.flip()) {
save();
Iris.info("LazyGen: " + world.getName() + " RTT: " + Form.duration((Math.pow((job.radiusBlocks / 16D), 2) / job.chunksPerMinute) * 60 * 1000, 2));
}
if(job.getPosition() >= maxPosition)
{
if(job.isHealing())
{
if (job.getPosition() >= maxPosition) {
if (job.isHealing()) {
int pos = (job.getHealingPosition() + 1) % maxPosition;
job.setHealingPosition(pos);
tickRegenerate(getChunk(pos));
}
else
{
} else {
Iris.verbose("Completed Lazy Gen!");
interrupt();
}
}
else
{
} else {
int pos = job.getPosition() + 1;
job.setPosition(pos);
tickGenerate(getChunk(pos));
@ -100,8 +104,7 @@ public class LazyPregenerator extends Thread implements Listener
private void tickGenerate(Position2 chunk) {
if (PaperLib.isPaper()) {
PaperLib.getChunkAtAsync(world, chunk.getX(), chunk.getZ(), true).thenAccept((i) -> Iris.verbose("Generated Async " + chunk));
}
else {
} else {
J.s(() -> world.getChunkAt(chunk.getX(), chunk.getZ()));
Iris.verbose("Generated " + chunk);
}
@ -112,8 +115,7 @@ public class LazyPregenerator extends Thread implements Listener
Iris.verbose("Regenerated " + chunk);
}
public Position2 getChunk(int position)
{
public Position2 getChunk(int position) {
int p = -1;
AtomicInteger xx = new AtomicInteger();
AtomicInteger zz = new AtomicInteger();
@ -129,14 +131,11 @@ public class LazyPregenerator extends Thread implements Listener
return new Position2(xx.get(), zz.get());
}
public void save()
{
public void save() {
J.a(() -> {
try {
saveNow();
}
catch (Throwable e) {
} catch (Throwable e) {
e.printStackTrace();
}
});
@ -146,33 +145,19 @@ public class LazyPregenerator extends Thread implements Listener
IO.writeAll(this.destination, new Gson().toJson(job));
}
public static void loadLazyGenerators()
{
for(World i : Bukkit.getWorlds())
{
File lazygen = new File(i.getWorldFolder(), "lazygen.json");
if(lazygen.exists()) {
try {
LazyPregenerator p = new LazyPregenerator(lazygen);
p.start();
Iris.info("Started Lazy Pregenerator: " + p.job);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
}
@Data
@Builder
public static class LazyPregenJob
{
public static class LazyPregenJob {
private String world;
@Builder.Default private int healingPosition = 0;
@Builder.Default private boolean healing = false;
@Builder.Default private int chunksPerMinute = 32; // 48 hours is roughly 5000 radius
@Builder.Default private int radiusBlocks = 5000;
@Builder.Default private int position = 0;
@Builder.Default
private int healingPosition = 0;
@Builder.Default
private boolean healing = false;
@Builder.Default
private int chunksPerMinute = 32; // 48 hours is roughly 5000 radius
@Builder.Default
private int radiusBlocks = 5000;
@Builder.Default
private int position = 0;
}
}

View File

@ -43,10 +43,8 @@ public interface PregeneratorMethod {
/**
* Return true if regions can be generated
*
* @param x
* the x region
* @param z
* the z region
* @param x the x region
* @param z the z region
* @return true if they can be
*/
boolean supportsRegions(int x, int z, PregenListener listener);
@ -54,10 +52,8 @@ public interface PregeneratorMethod {
/**
* Return the name of the method being used
*
* @param x
* the x region
* @param z
* the z region
* @param x the x region
* @param z the z region
* @return the name
*/
String getMethod(int x, int z);
@ -66,22 +62,17 @@ public interface PregeneratorMethod {
* Called to generate a region. Execute sync, if multicore internally, wait
* for the task to complete
*
* @param x
* the x
* @param z
* the z
* @param listener
* signal chunks generating & generated. Parallel capable.
* @param x the x
* @param z the z
* @param listener signal chunks generating & generated. Parallel capable.
*/
void generateRegion(int x, int z, PregenListener listener);
/**
* Called to generate a chunk. You can go async so long as save will wait on the threads to finish
*
* @param x
* the x
* @param z
* the z
* @param x the x
* @param z the z
*/
void generateChunk(int x, int z, PregenListener listener);

View File

@ -540,7 +540,8 @@ public class SchemaBuilder {
warnings.add("Undefined array type for field " + k.getName() + " (" + k.getType().getSimpleName() + ") in class " + cl.getSimpleName());
}
}
default -> warnings.add("Unexpected Schema Type: " + type + " for field " + k.getName() + " (" + k.getType().getSimpleName() + ") in class " + cl.getSimpleName());
default ->
warnings.add("Unexpected Schema Type: " + type + " for field " + k.getName() + " (" + k.getType().getSimpleName() + ") in class " + cl.getSimpleName());
}
KList<String> d = new KList<>();

View File

@ -38,8 +38,8 @@ import java.util.concurrent.CompletableFuture;
public class CommandSVC implements IrisService, DecreeSystem {
private final KMap<String, CompletableFuture<String>> futures = new KMap<>();
private CompletableFuture<String> consoleFuture = null;
private final transient AtomicCache<VirtualDecreeCommand> commandCache = new AtomicCache<>();
private CompletableFuture<String> consoleFuture = null;
@Override
public void onEnable() {

View File

@ -18,9 +18,7 @@
package com.volmit.iris.core.service;
import com.volmit.iris.Iris;
import com.volmit.iris.core.tools.IrisToolbelt;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.framework.Engine;
import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.function.Consumer4;
@ -39,7 +37,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.generator.structure.StructureType;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
public class DolphinSVC implements IrisService {
@ -82,7 +79,8 @@ public class DolphinSVC implements IrisService {
ref.set(d);
consumer.accept(x, y, z, d);
}
} : (x, y, z, d) -> { });
} : (x, y, z, d) -> {
});
}
@ChunkCoordinates
@ -91,6 +89,7 @@ public class DolphinSVC implements IrisService {
new Spiraler(radius * 2, radius * 2, (x, z) -> findTreasure(engine, x, z, type, ref.get() == null ? (i, d, g, a) -> {
ref.set(a);
consumer.accept(i, d, g, a);
} : (i, d, g, a) -> { })).setOffset(chunkX, chunkY).drain();
} : (i, d, g, a) -> {
})).setOffset(chunkX, chunkY).drain();
}
}

View File

@ -43,7 +43,8 @@ public class ExternalDataSVC implements IrisService {
}
@Override
public void onDisable() { }
public void onDisable() {
}
public void addProvider(ExternalDataProvider... provider) {
for (ExternalDataProvider p : provider) {

View File

@ -23,35 +23,97 @@ public class LogFilterSVC implements IrisService, Filter {
((Logger) LogManager.getRootLogger()).addFilter(this);
}
public void initialize() { }
public void start() { }
public void stop() { }
public void onDisable() { }
public boolean isStarted() { return true; }
public boolean isStopped() { return false; }
public State getState() {
try { return State.STARTED; }
catch (Exception var2) { return null; }
public void initialize() {
}
public Filter.Result getOnMatch() { return Result.NEUTRAL; }
public Filter.Result getOnMismatch() { return Result.NEUTRAL; }
public void start() {
}
public Result filter(LogEvent event) { return check(event.getMessage().getFormattedMessage()); }
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) { return check(msg.toString()); }
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) { return check(msg.getFormattedMessage()); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object... params) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) { return check(message); }
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) { return check(message); }
public void stop() {
}
public void onDisable() {
}
public boolean isStarted() {
return true;
}
public boolean isStopped() {
return false;
}
public State getState() {
try {
return State.STARTED;
} catch (Exception var2) {
return null;
}
}
public Filter.Result getOnMatch() {
return Result.NEUTRAL;
}
public Filter.Result getOnMismatch() {
return Result.NEUTRAL;
}
public Result filter(LogEvent event) {
return check(event.getMessage().getFormattedMessage());
}
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
return check(msg.toString());
}
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) {
return check(msg.getFormattedMessage());
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object... params) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8) {
return check(message);
}
public Result filter(Logger logger, Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) {
return check(message);
}
private Result check(String string) {
if (FILTERS.stream().anyMatch(string::contains))

View File

@ -65,8 +65,7 @@ public class ObjectSVC implements IrisService {
/**
* Reverts all the block changes provided, 200 blocks per tick
*
* @param blocks
* The blocks to remove
* @param blocks The blocks to remove
*/
private void revert(Map<Block, BlockData> blocks) {
int amount = 0;

View File

@ -36,8 +36,8 @@ import java.util.stream.Collectors;
public class PreservationSVC implements IrisService {
private final List<Thread> threads = new CopyOnWriteArrayList<>();
private final List<ExecutorService> services = new CopyOnWriteArrayList<>();
private Looper dereferencer;
private final List<MeteredCache> caches = new CopyOnWriteArrayList<>();
private Looper dereferencer;
public void register(Thread t) {
threads.add(t);

View File

@ -66,8 +66,7 @@ public class TreeSVC implements IrisService {
* <br>4. Check biome, region and dimension for overrides for that sapling type -> Found -> use</br>
* <br>5. Exit if none are found, cancel event if one or more are.</br>
*
* @param event
* Checks the given event for sapling overrides
* @param event Checks the given event for sapling overrides
*/
@EventHandler(priority = EventPriority.HIGHEST)
public void on(StructureGrowEvent event) {
@ -229,14 +228,10 @@ public class TreeSVC implements IrisService {
* Finds a single object placement (which may contain more than one object) for the requirements species, location &
* size
*
* @param worldAccess
* The world to access (check for biome, region, dimension, etc)
* @param location
* The location of the growth event (For biome/region finding)
* @param type
* The bukkit TreeType to match
* @param size
* The size of the sapling area
* @param worldAccess The world to access (check for biome, region, dimension, etc)
* @param location The location of the growth event (For biome/region finding)
* @param type The bukkit TreeType to match
* @param size The size of the sapling area
* @return An object placement which contains the matched tree, or null if none were found / it's disabled.
*/
private IrisObjectPlacement getObjectPlacement(PlatformChunkGenerator worldAccess, Location location, TreeType type, IrisTreeSize size) {
@ -261,12 +256,9 @@ public class TreeSVC implements IrisService {
/**
* Filters out mismatches and returns matches
*
* @param objects
* The object placements to check
* @param size
* The size of the sapling area to filter with
* @param type
* The type of the tree to filter with
* @param objects The object placements to check
* @param size The size of the sapling area to filter with
* @param type The type of the tree to filter with
* @return A list of objectPlacements that matched. May be empty.
*/
private KList<IrisObjectPlacement> matchObjectPlacements(KList<IrisObjectPlacement> objects, IrisTreeSize size, TreeType type) {
@ -285,12 +277,9 @@ public class TreeSVC implements IrisService {
/**
* Get the Cuboid of sapling sizes at a location & blockData predicate
*
* @param at
* this location
* @param valid
* with this blockData predicate
* @param world
* the world to check in
* @param at this location
* @param valid with this blockData predicate
* @param world the world to check in
* @return A cuboid containing only saplings
*/
public Cuboid getSaplings(Location at, Predicate<BlockData> valid, World world) {
@ -342,14 +331,10 @@ public class TreeSVC implements IrisService {
/**
* Grows the blockPosition list by means of checking neighbours in
*
* @param world
* the world to check in
* @param center
* the location of this position
* @param valid
* validation on blockData to check block with
* @param l
* list of block positions to add new neighbors too
* @param world the world to check in
* @param center the location of this position
* @param valid validation on blockData to check block with
* @param l list of block positions to add new neighbors too
*/
private void grow(World world, BlockPosition center, Predicate<BlockData> valid, KList<BlockPosition> l) {
// Make sure size is less than 50, the block to check isn't already in, and make sure the blockData still matches

View File

@ -62,8 +62,7 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris Object from the 2 coordinates selected with a wand
*
* @param p
* The wand player
* @param p The wand player
* @return The new object
*/
public static IrisObject createSchematic(Player p) {
@ -118,8 +117,7 @@ public class WandSVC implements IrisService {
/**
* Converts a user friendly location string to an actual Location
*
* @param s
* The string
* @param s The string
* @return The location
*/
public static Location stringToLocation(String s) {
@ -136,8 +134,7 @@ public class WandSVC implements IrisService {
/**
* Get a user friendly string of a location
*
* @param loc
* The location
* @param loc The location
* @return The string
*/
public static String locationToString(Location loc) {
@ -178,8 +175,7 @@ public class WandSVC implements IrisService {
/**
* Finds an existing wand in a users inventory
*
* @param inventory
* The inventory to search
* @param inventory The inventory to search
* @return The slot number the wand is in. Or -1 if none are found
*/
public static int findWand(Inventory inventory) {
@ -203,10 +199,8 @@ public class WandSVC implements IrisService {
/**
* Creates an Iris wand. The locations should be the currently selected locations, or null
*
* @param a
* Location A
* @param b
* Location B
* @param a Location A
* @param b Location B
* @return A new wand
*/
public static ItemStack createWand(Location a, Location b) {
@ -228,15 +222,13 @@ public class WandSVC implements IrisService {
}
public static Location[] getCuboid(Player p) {
if(isHoldingIrisWand(p))
{
if (isHoldingIrisWand(p)) {
return getCuboidFromItem(p.getInventory().getItemInMainHand());
}
Cuboid c = WorldEditLink.getSelection(p);
if(c != null)
{
if (c != null) {
return new Location[]{c.getLowerNE(), c.getUpperSW()};
}
@ -255,8 +247,7 @@ public class WandSVC implements IrisService {
/**
* Is the itemstack passed an Iris wand
*
* @param is
* The itemstack
* @param is The itemstack
* @return True if it is
*/
public static boolean isWand(ItemStack is) {
@ -303,10 +294,8 @@ public class WandSVC implements IrisService {
/**
* Draw the outline of a selected region
*
* @param d
* The cuboid
* @param p
* The player to show it to
* @param d The cuboid
* @param p The player to show it to
*/
public void draw(Cuboid d, Player p) {
draw(new Location[]{d.getLowerNE(), d.getUpperSW()}, p);
@ -315,10 +304,8 @@ public class WandSVC implements IrisService {
/**
* Draw the outline of a selected region
*
* @param d
* A pair of locations
* @param p
* The player to show them to
* @param d A pair of locations
* @param p The player to show them to
*/
public void draw(Location[] d, Player p) {
Vector gx = Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65);
@ -423,8 +410,7 @@ public class WandSVC implements IrisService {
/**
* Is the player holding Dust?
*
* @param p
* The player
* @param p The player
* @return True if they are
*/
public boolean isHoldingDust(Player p) {
@ -435,8 +421,7 @@ public class WandSVC implements IrisService {
/**
* Is the itemstack passed Iris dust?
*
* @param is
* The itemstack
* @param is The itemstack
* @return True if it is
*/
public boolean isDust(ItemStack is) {
@ -446,12 +431,9 @@ public class WandSVC implements IrisService {
/**
* Update the location on an Iris wand
*
* @param left
* True for first location, false for second
* @param a
* The location
* @param item
* The wand
* @param left True for first location, false for second
* @param a The location
* @param item The wand
* @return The updated wand
*/
public ItemStack update(boolean left, Location a, ItemStack item) {

View File

@ -51,32 +51,28 @@ import java.util.function.Supplier;
@Data
@Accessors(fluent = true, chain = true)
public class IrisCreator {
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml");
/**
* Specify an area to pregenerate during creation
*/
private PregenTask pregen;
/**
* Specify a sender to get updates & progress info + tp when world is created.
*/
private VolmitSender sender;
/**
* The seed to use for this generator
*/
private long seed = 1337;
/**
* The dimension to use. This can be any online dimension, or a dimension in the
* packs folder
*/
private String dimension = IrisSettings.get().getGenerator().getDefaultWorldType();
/**
* The name of this world.
*/
private String name = "irisworld";
/**
* Studio mode makes the engine hotloadable and uses the dimension in
* your Iris/packs folder instead of copying the dimension files into
@ -84,12 +80,25 @@ public class IrisCreator {
*/
private boolean studio = false;
public static boolean removeFromBukkitYml(String name) throws IOException {
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
ConfigurationSection section = yml.getConfigurationSection("worlds");
if (section == null) {
return false;
}
section.set(name, null);
if (section.getValues(false).keySet().stream().noneMatch(k -> section.get(k) != null)) {
yml.set("worlds", null);
}
yml.save(BUKKIT_YML);
return true;
}
/**
* Create the IrisAccess (contains the world)
*
* @return the IrisAccess
* @throws IrisException
* shit happens
* @throws IrisException shit happens
*/
public World create() throws IrisException {
if (Bukkit.isPrimaryThread()) {
@ -212,8 +221,6 @@ public class IrisCreator {
return world.get();
}
private static final File BUKKIT_YML = new File(Bukkit.getServer().getWorldContainer(), "bukkit.yml");
private void addToBukkitYml() {
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
String gen = "Iris:" + dimension;
@ -229,18 +236,4 @@ public class IrisCreator {
}
}
}
public static boolean removeFromBukkitYml(String name) throws IOException {
YamlConfiguration yml = YamlConfiguration.loadConfiguration(BUKKIT_YML);
ConfigurationSection section = yml.getConfigurationSection("worlds");
if (section == null) {
return false;
}
section.set(name, null);
if (section.getValues(false).keySet().stream().noneMatch(k -> section.get(k) != null)) {
yml.set("worlds", null);
}
yml.save(BUKKIT_YML);
return true;
}
}

View File

@ -54,8 +54,7 @@ public class IrisToolbelt {
* - GithubUsername/repository
* - GithubUsername/repository/branch
*
* @param dimension
* the dimension id such as overworld or flat
* @param dimension the dimension id such as overworld or flat
* @return the IrisDimension or null
*/
public static IrisDimension getDimension(String dimension) {
@ -84,8 +83,7 @@ public class IrisToolbelt {
/**
* Checks if the given world is an Iris World (same as access(world) != null)
*
* @param world
* the world
* @param world the world
* @return true if it is an Iris Access world
*/
public static boolean isIrisWorld(World world) {
@ -108,8 +106,7 @@ public class IrisToolbelt {
/**
* Get the Iris generator for the given world
*
* @param world
* the given world
* @param world the given world
* @return the IrisAccess or null if it's not an Iris World
*/
public static PlatformChunkGenerator access(World world) {
@ -139,10 +136,8 @@ public class IrisToolbelt {
/**
* Start a pregenerator task
*
* @param task
* the scheduled task
* @param method
* the method to execute the task
* @param task the scheduled task
* @param method the method to execute the task
* @return the pregenerator job (already started)
*/
public static PregeneratorJob pregenerate(PregenTask task, PregeneratorMethod method, Engine engine) {
@ -153,10 +148,8 @@ public class IrisToolbelt {
* Start a pregenerator task. If the supplied generator is headless, headless mode is used,
* otherwise Hybrid mode is used.
*
* @param task
* the scheduled task
* @param gen
* the Iris Generator
* @param task the scheduled task
* @param gen the Iris Generator
* @return the pregenerator job (already started)
*/
public static PregeneratorJob pregenerate(PregenTask task, PlatformChunkGenerator gen) {
@ -168,10 +161,8 @@ public class IrisToolbelt {
* Start a pregenerator task. If the supplied generator is headless, headless mode is used,
* otherwise Hybrid mode is used.
*
* @param task
* the scheduled task
* @param world
* the World
* @param task the scheduled task
* @param world the World
* @return the pregenerator job (already started)
*/
public static PregeneratorJob pregenerate(PregenTask task, World world) {
@ -186,8 +177,7 @@ public class IrisToolbelt {
* Evacuate all players from the world into literally any other world.
* If there are no other worlds, kick them! Not the best but what's mine is mine sometimes...
*
* @param world
* the world to evac
* @param world the world to evac
*/
public static boolean evacuate(World world) {
for (World i : Bukkit.getWorlds()) {
@ -207,10 +197,8 @@ public class IrisToolbelt {
/**
* Evacuate all players from the world
*
* @param world
* the world to leave
* @param m
* the message
* @param world the world to leave
* @param m the message
* @return true if it was evacuated.
*/
public static boolean evacuate(World world, String m) {
@ -237,13 +225,17 @@ public class IrisToolbelt {
public static <T> T getMantleData(World world, int x, int y, int z, Class<T> of) {
PlatformChunkGenerator e = access(world);
if(e == null) {return null;}
if (e == null) {
return null;
}
return e.getEngine().getMantle().getMantle().get(x, y - world.getMinHeight(), z, of);
}
public static <T> void deleteMantleData(World world, int x, int y, int z, Class<T> of) {
PlatformChunkGenerator e = access(world);
if(e == null) {return;}
if (e == null) {
return;
}
e.getEngine().getMantle().getMantle().remove(x, y - world.getMinHeight(), z, of);
}

View File

@ -319,7 +319,8 @@ public class IrisComplex implements DataProvider {
}
return 0;
});;
});
;
double d = 0;

View File

@ -25,7 +25,6 @@ import com.volmit.iris.core.ServerConfigurator;
import com.volmit.iris.core.events.IrisEngineHotloadEvent;
import com.volmit.iris.core.gui.PregeneratorJob;
import com.volmit.iris.core.project.IrisProject;
import com.volmit.iris.core.service.DolphinSVC;
import com.volmit.iris.core.service.PreservationSVC;
import com.volmit.iris.engine.data.cache.AtomicCache;
import com.volmit.iris.engine.framework.*;
@ -64,7 +63,6 @@ import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
@Data
public class IrisEngine implements Engine {
@ -83,11 +81,11 @@ public class IrisEngine implements Engine {
private final boolean studio;
private final AtomicRollingSequence wallClock;
private final int art;
private EngineMode mode;
private final AtomicCache<IrisEngineData> engineData = new AtomicCache<>();
private final AtomicBoolean cleaning;
private final ChronoLatch cleanLatch;
private final SeedManager seedManager;
private EngineMode mode;
private EngineEffects effects;
private EngineExecutionEnvironment execution;
private EngineWorldManager worldManager;
@ -237,7 +235,11 @@ public class IrisEngine implements Engine {
getTarget().setDimension(getData().getDimensionLoader().load(getDimension().getLoadKey()));
prehotload();
setupEngine();
J.a(() -> { synchronized(ServerConfigurator.class) { ServerConfigurator.installDataPacks(false); } });
J.a(() -> {
synchronized (ServerConfigurator.class) {
ServerConfigurator.installDataPacks(false);
}
});
}
@Override

View File

@ -67,14 +67,10 @@ public class IrisTerrainNormalActuator extends EngineAssignedActuator<BlockData>
/**
* This is calling 1/16th of a chunk x/z slice. It is a plane from sky to bedrock 1 thick in the x direction.
*
* @param x
* the chunk x in blocks
* @param z
* the chunk z in blocks
* @param xf
* the current x slice
* @param h
* the blockdata
* @param x the chunk x in blocks
* @param z the chunk z in blocks
* @param xf the current x slice
* @param h the blockdata
*/
@BlockCoordinates
public void terrainSliver(int x, int z, int xf, Hunk<BlockData> h, ChunkContext context) {

View File

@ -49,10 +49,8 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Get biome at x, z within chunk being generated
*
* @param x
* - 0-15
* @param z
* - 0-15
* @param x - 0-15
* @param z - 0-15
* @return Biome value
* @deprecated biomes are now 3-dimensional
*/
@ -63,12 +61,9 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Get biome at x, z within chunk being generated
*
* @param x
* - 0-15
* @param y
* - 0-255
* @param z
* - 0-15
* @param x - 0-15
* @param y - 0-255
* @param z - 0-15
* @return Biome value
*/
Biome getBiome(int x, int y, int z);
@ -76,12 +71,9 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Set biome at x, z within chunk being generated
*
* @param x
* - 0-15
* @param z
* - 0-15
* @param bio
* - Biome value
* @param x - 0-15
* @param z - 0-15
* @param bio - Biome value
* @deprecated biomes are now 3-dimensional
*/
@Deprecated
@ -90,14 +82,10 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
/**
* Set biome at x, z within chunk being generated
*
* @param x
* - 0-15
* @param y
* - 0-255
* @param z
* - 0-15
* @param bio
* - Biome value
* @param x - 0-15
* @param y - 0-255
* @param z - 0-15
* @param bio - Biome value
*/
void setBiome(int x, int y, int z, Biome bio);
@ -115,15 +103,11 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* <p>
* Setting blocks outside the chunk's bounds does nothing.
*
* @param x
* the x location in the chunk from 0-15 inclusive
* @param y
* the y location in the chunk from 0 (inclusive) - maxHeight
* @param x the x location in the chunk from 0-15 inclusive
* @param y the y location in the chunk from 0 (inclusive) - maxHeight
* (exclusive)
* @param z
* the z location in the chunk from 0-15 inclusive
* @param blockData
* the type to set the block to
* @param z the z location in the chunk from 0-15 inclusive
* @param blockData the type to set the block to
*/
void setBlock(int x, int y, int z, BlockData blockData);
@ -132,13 +116,10 @@ public interface TerrainChunk extends BiomeGrid, ChunkData {
* <p>
* Getting blocks outside the chunk's bounds returns air.
*
* @param x
* the x location in the chunk from 0-15 inclusive
* @param y
* the y location in the chunk from 0 (inclusive) - maxHeight
* @param x the x location in the chunk from 0-15 inclusive
* @param y the y location in the chunk from 0 (inclusive) - maxHeight
* (exclusive)
* @param z
* the z location in the chunk from 0-15 inclusive
* @param z the z location in the chunk from 0-15 inclusive
* @return the data of the block or the BlockData for air if x, y or z are
* outside the chunk's bounds
*/

View File

@ -24,7 +24,6 @@ import com.volmit.iris.core.gui.components.RenderType;
import com.volmit.iris.core.gui.components.Renderer;
import com.volmit.iris.core.loader.IrisData;
import com.volmit.iris.core.loader.IrisRegistrant;
import com.volmit.iris.core.service.DolphinSVC;
import com.volmit.iris.engine.IrisComplex;
import com.volmit.iris.engine.data.cache.Cache;
import com.volmit.iris.engine.data.chunk.TerrainChunk;
@ -68,7 +67,6 @@ import org.bukkit.block.BlockFace;
import org.bukkit.block.data.BlockData;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.generator.structure.StructureType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;

View File

@ -42,6 +42,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
public abstract class EngineAssignedWorldManager extends EngineAssignedComponent implements EngineWorldManager, Listener {
private final int taskId;
protected AtomicBoolean ignoreTP = new AtomicBoolean(false);
public EngineAssignedWorldManager() {
super(null, null);
@ -63,8 +64,6 @@ public abstract class EngineAssignedWorldManager extends EngineAssignedComponent
}
}
protected AtomicBoolean ignoreTP = new AtomicBoolean(false);
// @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
// public void on(PlayerTeleportEvent e) {
// if(ignoreTP.get()) {

View File

@ -31,6 +31,9 @@ import org.bukkit.block.Biome;
import org.bukkit.block.data.BlockData;
public interface EngineMode extends Staged {
public static final RollingSequence r = new RollingSequence(64);
public static final RollingSequence r2 = new RollingSequence(256);
void close();
Engine getEngine();
@ -64,9 +67,6 @@ public interface EngineMode extends Staged {
getMantle().generateMatter(x, z, multicore, context);
}
public static final RollingSequence r = new RollingSequence(64);
public static final RollingSequence r2 = new RollingSequence(256);
@BlockCoordinates
default void generate(int x, int z, Hunk<BlockData> blocks, Hunk<Biome> biomes, boolean multicore) {
ChunkContext ctx = new ChunkContext(x, z, getComplex());

View File

@ -52,8 +52,6 @@ import java.util.function.Consumer;
@FunctionalInterface
public interface Locator<T> {
boolean matches(Engine engine, Position2 chunk);
static void cancelSearch() {
if (LocatorCanceller.cancel != null) {
LocatorCanceller.cancel.run();
@ -61,6 +59,56 @@ public interface Locator<T> {
}
}
static Locator<IrisRegion> region(String loadKey) {
return (e, c) -> e.getRegion((c.getX() << 4) + 8, (c.getZ() << 4) + 8).getLoadKey().equals(loadKey);
}
static Locator<IrisJigsawStructure> jigsawStructure(String loadKey) {
return (e, c) -> {
IrisJigsawStructure s = e.getStructureAt(c.getX(), c.getZ());
return s != null && s.getLoadKey().equals(loadKey);
};
}
static Locator<IrisObject> object(String loadKey) {
return (e, c) -> e.getObjectsAt(c.getX(), c.getZ()).contains(loadKey);
}
static Locator<IrisBiome> surfaceBiome(String loadKey) {
return (e, c) -> e.getSurfaceBiome((c.getX() << 4) + 8, (c.getZ() << 4) + 8).getLoadKey().equals(loadKey);
}
static Locator<BlockPos> poi(String type) {
return (e, c) -> {
Set<Pair<String, BlockPos>> pos = e.getPOIsAt((c.getX() << 4) + 8, (c.getZ() << 4) + 8);
return pos.stream().anyMatch(p -> p.getA().equals(type));
};
}
static Locator<IrisBiome> caveBiome(String loadKey) {
return (e, c) -> e.getCaveBiome((c.getX() << 4) + 8, (c.getZ() << 4) + 8).getLoadKey().equals(loadKey);
}
static Locator<IrisBiome> caveOrMantleBiome(String loadKey) {
return (e, c) -> {
AtomicBoolean found = new AtomicBoolean(false);
e.generateMatter(c.getX(), c.getZ(), true, new ChunkContext(c.getX() << 4, c.getZ() << 4, e.getComplex(), false));
e.getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, y, z, t) -> {
if (found.get()) {
return;
}
if (t != null && t.getCustomBiome().equals(loadKey)) {
found.set(true);
}
});
return found.get();
};
}
boolean matches(Engine engine, Position2 chunk);
default void find(Player player) {
find(player, 30_000);
}
@ -152,52 +200,4 @@ public interface Locator<T> {
return null;
});
}
static Locator<IrisRegion> region(String loadKey) {
return (e, c) -> e.getRegion((c.getX() << 4) + 8, (c.getZ() << 4) + 8).getLoadKey().equals(loadKey);
}
static Locator<IrisJigsawStructure> jigsawStructure(String loadKey) {
return (e, c) -> {
IrisJigsawStructure s = e.getStructureAt(c.getX(), c.getZ());
return s != null && s.getLoadKey().equals(loadKey);
};
}
static Locator<IrisObject> object(String loadKey) {
return (e, c) -> e.getObjectsAt(c.getX(), c.getZ()).contains(loadKey);
}
static Locator<IrisBiome> surfaceBiome(String loadKey) {
return (e, c) -> e.getSurfaceBiome((c.getX() << 4) + 8, (c.getZ() << 4) + 8).getLoadKey().equals(loadKey);
}
static Locator<BlockPos> poi(String type) {
return (e, c) -> {
Set<Pair<String, BlockPos>> pos = e.getPOIsAt((c.getX() << 4) + 8, (c.getZ() << 4) + 8);
return pos.stream().anyMatch(p -> p.getA().equals(type));
};
}
static Locator<IrisBiome> caveBiome(String loadKey) {
return (e, c) -> e.getCaveBiome((c.getX() << 4) + 8, (c.getZ() << 4) + 8).getLoadKey().equals(loadKey);
}
static Locator<IrisBiome> caveOrMantleBiome(String loadKey) {
return (e, c) -> {
AtomicBoolean found = new AtomicBoolean(false);
e.generateMatter(c.getX(), c.getZ(), true, new ChunkContext(c.getX() << 4, c.getZ() << 4, e.getComplex(), false));
e.getMantle().getMantle().iterateChunk(c.getX(), c.getZ(), MatterCavern.class, (x, y, z, t) -> {
if(found.get()) {
return;
}
if(t != null && t.getCustomBiome().equals(loadKey)) {
found.set(true);
}
});
return found.get();
};
}
}

View File

@ -123,8 +123,7 @@ public class MantleWriter implements IObjectPlacer {
return (x * x) + (z * z);
}
public <T> void setDataWarped(int x, int y, int z, T t, RNG rng, IrisData data, IrisGeneratorStyle style)
{
public <T> void setDataWarped(int x, int y, int z, T t, RNG rng, IrisData data, IrisGeneratorStyle style) {
setData((int) Math.round(style.warp(rng, data, x, x, y, -z)),
(int) Math.round(style.warp(rng, data, y, z, -x, y)),
(int) Math.round(style.warp(rng, data, z, -y, z, x)), t);
@ -219,20 +218,13 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a sphere into the mantle
*
* @param cx
* the center x
* @param cy
* the center y
* @param cz
* the center z
* @param radius
* the radius of this sphere
* @param fill
* should it be filled? or just the outer shell?
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
* @param cx the center x
* @param cy the center y
* @param cz the center z
* @param radius the radius of this sphere
* @param fill should it be filled? or just the outer shell?
* @param data the data to set
* @param <T> the type of data to apply to the mantle
*/
public <T> void setSphere(int cx, int cy, int cz, double radius, boolean fill, T data) {
setElipsoid(cx, cy, cz, radius, radius, radius, fill, data);
@ -249,24 +241,15 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set an elipsoid into the mantle
*
* @param cx
* the center x
* @param cy
* the center y
* @param cz
* the center z
* @param rx
* the x radius
* @param ry
* the y radius
* @param rz
* the z radius
* @param fill
* should it be filled or just the outer shell?
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
* @param cx the center x
* @param cy the center y
* @param cz the center z
* @param rx the x radius
* @param ry the y radius
* @param rz the z radius
* @param fill should it be filled or just the outer shell?
* @param data the data to set
* @param <T> the type of data to apply to the mantle
*/
public <T> void setElipsoidFunction(int cx, int cy, int cz, double rx, double ry, double rz, boolean fill, Function3<Integer, Integer, Integer, T> data) {
rx += 0.5;
@ -385,22 +368,14 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a cuboid of data in the mantle
*
* @param x1
* the min x
* @param y1
* the min y
* @param z1
* the min z
* @param x2
* the max x
* @param y2
* the max y
* @param z2
* the max z
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
* @param x1 the min x
* @param y1 the min y
* @param z1 the min z
* @param x2 the max x
* @param y2 the max y
* @param z2 the max z
* @param data the data to set
* @param <T> the type of data to apply to the mantle
*/
public <T> void setCuboid(int x1, int y1, int z1, int x2, int y2, int z2, T data) {
int j, k;
@ -417,20 +392,13 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a pyramid of data in the mantle
*
* @param cx
* the center x
* @param cy
* the base y
* @param cz
* the center z
* @param data
* the data to set
* @param size
* the size of the pyramid (width of base & height)
* @param filled
* should it be filled or hollow
* @param <T>
* the type of data to apply to the mantle
* @param cx the center x
* @param cy the base y
* @param cz the center z
* @param data the data to set
* @param size the size of the pyramid (width of base & height)
* @param filled should it be filled or hollow
* @param <T> the type of data to apply to the mantle
*/
@SuppressWarnings("ConstantConditions")
public <T> void setPyramid(int cx, int cy, int cz, T data, int size, boolean filled) {
@ -454,18 +422,12 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a 3d line
*
* @param a
* the first point
* @param b
* the second point
* @param radius
* the radius
* @param filled
* hollow or filled?
* @param data
* the data
* @param <T>
* the type of data to apply to the mantle
* @param a the first point
* @param b the second point
* @param radius the radius
* @param filled hollow or filled?
* @param data the data
* @param <T> the type of data to apply to the mantle
*/
public <T> void setLine(IrisPosition a, IrisPosition b, double radius, boolean filled, T data) {
setLine(ImmutableList.of(a, b), radius, filled, data);
@ -478,16 +440,11 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set lines for points
*
* @param vectors
* the points
* @param radius
* the radius
* @param filled
* hollow or filled?
* @param data
* the data to set
* @param <T>
* the type of data to apply to the mantle
* @param vectors the points
* @param radius the radius
* @param filled hollow or filled?
* @param data the data to set
* @param <T> the type of data to apply to the mantle
*/
public <T> void setLineConsumer(List<IrisPosition> vectors, double radius, boolean filled, Function3<Integer, Integer, Integer, T> data) {
Set<IrisPosition> vset = new KSet<>();
@ -553,20 +510,13 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a cylinder in the mantle
*
* @param cx
* the center x
* @param cy
* the base y
* @param cz
* the center z
* @param data
* the data to set
* @param radius
* the radius
* @param height
* the height of the cyl
* @param filled
* filled or not
* @param cx the center x
* @param cy the base y
* @param cz the center z
* @param data the data to set
* @param radius the radius
* @param height the height of the cyl
* @param filled filled or not
*/
public <T> void setCylinder(int cx, int cy, int cz, T data, double radius, int height, boolean filled) {
setCylinder(cx, cy, cz, data, radius, radius, height, filled);
@ -575,22 +525,14 @@ public class MantleWriter implements IObjectPlacer {
/**
* Set a cylinder in the mantle
*
* @param cx
* the center x
* @param cy
* the base y
* @param cz
* the center z
* @param data
* the data to set
* @param radiusX
* the x radius
* @param radiusZ
* the z radius
* @param height
* the height of this cyl
* @param filled
* filled or hollow?
* @param cx the center x
* @param cy the base y
* @param cz the center z
* @param data the data to set
* @param radiusX the x radius
* @param radiusZ the z radius
* @param height the height of this cyl
* @param filled filled or hollow?
*/
public <T> void setCylinder(int cx, int cy, int cz, T data, double radiusX, double radiusZ, int height, boolean filled) {
int affected = 0;

View File

@ -35,7 +35,6 @@ import com.volmit.iris.util.documentation.ChunkCoordinates;
import com.volmit.iris.util.mantle.MantleFlag;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.MatterStructurePOI;
import com.volmit.iris.util.matter.slices.StructurePOIMatter;
import java.util.Set;

View File

@ -52,6 +52,23 @@ import java.io.IOException;
public class IrisDimension extends IrisRegistrant {
public static final BlockData STONE = Material.STONE.createBlockData();
public static final BlockData WATER = Material.WATER.createBlockData();
private static final String DP_OVERWORLD_DEFAULT = """
{
"ultrawarm": false,
"natural": true,
"coordinate_scale": 1.0,
"has_skylight": true,
"has_ceiling": false,
"ambient_light": 0,
"piglin_safe": false,
"bed_works": true,
"respawn_anchor_works": false,
"has_raids": true,
"monster_spawn_block_light_limit": 7,
"monster_spawn_light_level": 1,
"infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld"
}""";
private final transient AtomicCache<Position2> parallaxSize = new AtomicCache<>();
private final transient AtomicCache<CNG> rockLayerGenerator = new AtomicCache<>();
private final transient AtomicCache<CNG> fluidLayerGenerator = new AtomicCache<>();
@ -69,7 +86,6 @@ public class IrisDimension extends IrisRegistrant {
@MaxNumber(2032)
@Desc("Maximum height at which players can be teleported to through gameplay.")
private int logicalHeight = 256;
@RegistryListResource(IrisJigsawStructure.class)
@Desc("If defined, Iris will place the given jigsaw structure where minecraft should place the overworld stronghold.")
private String stronghold;
@ -461,22 +477,4 @@ public class IrisDimension extends IrisRegistrant {
obj.put("logical_height", logicalHeight);
return obj.toString(4);
}
private static final String DP_OVERWORLD_DEFAULT = """
{
"ultrawarm": false,
"natural": true,
"coordinate_scale": 1.0,
"has_skylight": true,
"has_ceiling": false,
"ambient_light": 0,
"piglin_safe": false,
"bed_works": true,
"respawn_anchor_works": false,
"has_raids": true,
"monster_spawn_block_light_limit": 7,
"monster_spawn_light_level": 1,
"infiniburn": "#minecraft:infiniburn_overworld",
"effects": "minecraft:overworld"
}""";
}

View File

@ -174,8 +174,7 @@ public enum IrisDirection {
* Get the directional value from the given byte from common directional blocks
* (MUST BE BETWEEN 0 and 5 INCLUSIVE)
*
* @param b
* the byte
* @param b the byte
* @return the direction or null if the byte is outside of the inclusive range
* 0-5
*/

View File

@ -86,8 +86,7 @@ public class IrisGeneratorStyle {
}
private int hash()
{
private int hash() {
return Objects.hash(expression, imageMap, multiplier, axialFracturing, fracture != null ? fracture.hash() : 0, exponent, cacheSize, zoom, cellularZoom, cellularFrequency, style);
}
@ -141,8 +140,7 @@ public class IrisGeneratorStyle {
return cng;
}
public double warp(RNG rng, IrisData data, double value, double... coords)
{
public double warp(RNG rng, IrisData data, double value, double... coords) {
return create(rng, data).noise(coords) + value;
}

View File

@ -32,6 +32,14 @@ import java.io.IOException;
public class IrisImage extends IrisRegistrant {
private final BufferedImage image;
public IrisImage() {
this(new BufferedImage(4, 4, BufferedImage.TYPE_INT_RGB));
}
public IrisImage(BufferedImage image) {
this.image = image;
}
public int getWidth() {
return image.getWidth();
}
@ -99,14 +107,6 @@ public class IrisImage extends IrisRegistrant {
return color;
}
public IrisImage() {
this(new BufferedImage(4, 4, BufferedImage.TYPE_INT_RGB));
}
public IrisImage(BufferedImage image) {
this.image = image;
}
@Override
public String getFolderName() {
return "images";

View File

@ -61,7 +61,6 @@ import java.io.*;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ -1189,5 +1188,6 @@ public class IrisObject extends IrisRegistrant {
}
@Override
public void scanForErrors(JSONObject p, VolmitSender sender) { }
public void scanForErrors(JSONObject p, VolmitSender sender) {
}
}

View File

@ -35,26 +35,22 @@ import org.bukkit.block.data.BlockData;
@Desc("Find blocks to mark")
@Data
public class IrisObjectMarker {
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
@ArrayType(min = 1, type = IrisBlockData.class)
@Required
@Desc("Find block types to mark")
private KList<IrisBlockData> mark = new KList<>();
@MinNumber(1)
@MaxNumber(16)
@Desc("The maximum amount of markers to place. Use these sparingly!")
private int maximumMarkers = 8;
@Desc("If true, markers will only be placed if the block matches the mark list perfectly.")
private boolean exact = false;
@Required
@RegistryListResource(IrisMarker.class)
@Desc("The marker to add")
private String marker;
private final transient AtomicCache<KList<BlockData>> findData = new AtomicCache<>();
public KList<BlockData> getMark(IrisData rdata) {
return findData.aquire(() ->
{

View File

@ -241,10 +241,8 @@ public class IrisObjectPlacement {
/**
* Gets the loot table that should be used for the block
*
* @param data
* The block data of the block
* @param dataManager
* Iris Data Manager
* @param data The block data of the block
* @param dataManager Iris Data Manager
* @return The loot table it should use.
*/
public IrisLootTable getTable(BlockData data, IrisData dataManager) {

View File

@ -44,8 +44,7 @@ public enum IrisSurface {
/**
* Check if this Iris surface matches the blockstate provided
*
* @param state
* The blockstate
* @param state The blockstate
* @return True if it matches
*/
public boolean matches(Block state) {

View File

@ -45,8 +45,7 @@ public class IrisTreeSize {
/**
* Does the size match
*
* @param size
* the size to check match
* @param size the size to check match
* @return true if it matches (fits within width and depth)
*/
public boolean doesMatch(IrisTreeSize size) {

View File

@ -112,7 +112,8 @@ public class TileBanner implements TileData<Banner> {
public boolean isBanner(Material material) {
return switch (material) {
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER, YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER, LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER, CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER, BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER, PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER, PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER, LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER, GRAY_WALL_BANNER, BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER, BROWN_WALL_BANNER -> true;
case RED_BANNER, RED_WALL_BANNER, ORANGE_BANNER, ORANGE_WALL_BANNER, YELLOW_BANNER, YELLOW_WALL_BANNER, LIME_BANNER, LIME_WALL_BANNER, GREEN_BANNER, GREEN_WALL_BANNER, CYAN_BANNER, CYAN_WALL_BANNER, LIGHT_BLUE_BANNER, LIGHT_BLUE_WALL_BANNER, BLUE_BANNER, BLUE_WALL_BANNER, PURPLE_BANNER, PURPLE_WALL_BANNER, MAGENTA_BANNER, MAGENTA_WALL_BANNER, PINK_BANNER, PINK_WALL_BANNER, WHITE_BANNER, WHITE_WALL_BANNER, LIGHT_GRAY_BANNER, LIGHT_GRAY_WALL_BANNER, GRAY_BANNER, GRAY_WALL_BANNER, BLACK_BANNER, BLACK_WALL_BANNER, BROWN_BANNER, BROWN_WALL_BANNER ->
true;
default -> false;
};
}

View File

@ -52,7 +52,8 @@ public interface TileData<T extends TileState> extends Cloneable {
@SuppressWarnings("unchecked") TileData<? extends TileState> d = registry.get(id).getClass().getConstructor().newInstance();
d.fromBinary(s);
return d;
} catch(InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException e) {
} catch (InvocationTargetException | InstantiationException | IllegalAccessException |
NoSuchMethodException e) {
throw new IOException("Failed to create TileData instance due to missing type registrar!");
}
}

View File

@ -36,6 +36,7 @@ public class TileSpawner implements TileData<CreatureSpawner> {
public static final int id = 1;
private EntityType entityType;
@Override
public String getTileId() {
return "minecraft:mob_spawner";

View File

@ -17,23 +17,19 @@ import java.io.IOException;
public class IrisMatterObject extends IrisRegistrant {
private final Matter matter;
public IrisMatterObject()
{
public IrisMatterObject() {
this(1, 1, 1);
}
public IrisMatterObject(int w, int h, int d)
{
public IrisMatterObject(int w, int h, int d) {
this(new IrisMatter(w, h, d));
}
public IrisMatterObject(Matter matter)
{
public IrisMatterObject(Matter matter) {
this.matter = matter;
}
public static IrisMatterObject from(IrisObject object)
{
public static IrisMatterObject from(IrisObject object) {
return new IrisMatterObject(Matter.from(object));
}

View File

@ -62,15 +62,13 @@ public class IrisMatterPlacement implements IRare {
@Desc("Place this object on the surface height, bedrock or the sky, then use translate if need be.")
private IrisMatterPlacementLocation location = IrisMatterPlacementLocation.SURFACE;
public void place(IrisEngine engine, IrisData data, RNG rng, int ax, int az)
{
public void place(IrisEngine engine, IrisData data, RNG rng, int ax, int az) {
IrisMatterObject object = data.getMatterLoader().load(place.getRandom(rng));
int x = ax;
int z = az;
int yoff = 0;
if(translate != null)
{
if (translate != null) {
x += translate.xOffset(data, rng, x, z);
yoff += translate.yOffset(data, rng, x, z);
z += translate.zOffset(data, rng, x, z);
@ -83,8 +81,7 @@ public class IrisMatterPlacement implements IRare {
int yy = y;
int zz = z;
for(MatterSlice<?> slice : object.getMatter().getSliceMap().values())
{
for (MatterSlice<?> slice : object.getMatter().getSliceMap().values()) {
slice.iterate((mx, my, mz, v) -> {
mantle.set(xx + mx, yy + my, zz + mz, v);
});

View File

@ -3,6 +3,7 @@ package com.volmit.iris.engine.object.matter;
import com.volmit.iris.engine.IrisEngine;
import com.volmit.iris.engine.object.annotations.Desc;
import com.volmit.iris.util.function.Function3;
@Desc("WHERE THINGS PLACE")
public enum IrisMatterPlacementLocation {
SURFACE((e, x, z) -> e.getHeight(x, z, true)),
@ -12,8 +13,7 @@ public enum IrisMatterPlacementLocation {
private final Function3<IrisEngine, Integer, Integer, Integer> computer;
private IrisMatterPlacementLocation(Function3<IrisEngine, Integer, Integer, Integer> computer)
{
private IrisMatterPlacementLocation(Function3<IrisEngine, Integer, Integer, Integer> computer) {
this.computer = computer;
}

View File

@ -30,30 +30,24 @@ public class IrisMatterTranslate {
@Desc("Define an absolute shift instead of varied.")
private int z = 0;
public int xOffset(IrisData data, RNG rng, int rx, int rz)
{
if(rangeX != null)
{
public int xOffset(IrisData data, RNG rng, int rx, int rz) {
if (rangeX != null) {
return (int) Math.round(rangeX.get(rng, rx, rz, data));
}
return x;
}
public int yOffset(IrisData data, RNG rng, int rx, int rz)
{
if(rangeY != null)
{
public int yOffset(IrisData data, RNG rng, int rx, int rz) {
if (rangeY != null) {
return (int) Math.round(rangeY.get(rng, rx, rz, data));
}
return y;
}
public int zOffset(IrisData data, RNG rng, int rx, int rz)
{
if(rangeZ != null)
{
public int zOffset(IrisData data, RNG rng, int rx, int rz) {
if (rangeZ != null) {
return (int) Math.round(rangeZ.get(rng, rx, rz, data));
}

View File

@ -84,6 +84,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
private final ChronoLatch hotloadChecker;
private final AtomicBoolean setup;
private final boolean studio;
private final AtomicInteger a = new AtomicInteger(0);
private Engine engine;
private Looper hotloader;
private StudioMode lastMode;
@ -106,6 +107,20 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
Bukkit.getServer().getPluginManager().registerEvents(this, Iris.instance);
}
private static Field getField(Class clazz, String fieldName)
throws NoSuchFieldException {
try {
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
Class superClass = clazz.getSuperclass();
if (superClass == null) {
throw e;
} else {
return getField(superClass, fieldName);
}
}
}
@EventHandler
public void onWorldInit(WorldInitEvent event) {
try {
@ -122,32 +137,14 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
unsafe.putObject(biomeSource.get(serverLevel.getChunkSource().chunkMap.generator), unsafe.objectFieldOffset(biomeSource), customBiomeSource);
biomeSource.set(serverLevel.getChunkSource().chunkMap.generator, customBiomeSource);
Iris.info("Injected Iris Biome Source into " + event.getWorld().getName());
}
else {
} else {
Iris.info("World " + event.getWorld().getName() + " is not an Iris world in this context");
}
}
catch(Throwable e) {
} catch (Throwable e) {
e.printStackTrace();
}
}
private static Field getField(Class clazz, String fieldName)
throws NoSuchFieldException {
try {
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException e) {
Class superClass = clazz.getSuperclass();
if (superClass == null) {
throw e;
} else {
return getField(superClass, fieldName);
}
}
}
private void setupEngine() {
IrisData data = IrisData.get(dataLocation);
IrisDimension dimension = data.getDimensionLoader().load(dimensionKey);
@ -252,8 +249,7 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
lock.lock();
if(setup.get())
{
if (setup.get()) {
return getEngine();
}
@ -328,8 +324,6 @@ public class BukkitChunkGenerator extends ChunkGenerator implements PlatformChun
getEngine(world);
}
private final AtomicInteger a = new AtomicInteger(0);
@Override
public void generateNoise(@NotNull WorldInfo world, @NotNull Random random, int x, int z, @NotNull ChunkGenerator.ChunkData d) {
try {

View File

@ -40,8 +40,7 @@ public class AtomicAverage {
/**
* Create an average holder
*
* @param size
* the size of entries to keep
* @param size the size of entries to keep
*/
public AtomicAverage(int size) {
values = new AtomicDoubleArray(size);
@ -56,8 +55,7 @@ public class AtomicAverage {
/**
* Put a value into the average (rolls over if full)
*
* @param i
* the value
* @param i the value
*/
public void put(double i) {

View File

@ -24,6 +24,18 @@ import java.io.DataOutputStream;
import java.io.IOException;
public interface ArrayCache<T> extends Writable<T> {
static int zigZag(int coord, int size) {
if (coord < 0) {
coord = Math.abs(coord);
}
if (coord % (size * 2) >= size) {
return (size) - (coord % size) - 1;
} else {
return coord % size;
}
}
T get(int i);
void set(int i, T t);
@ -36,44 +48,20 @@ public interface ArrayCache<T> extends Writable<T> {
void writeCache(DataOutputStream dos) throws IOException;
static int zigZag(int coord, int size)
{
if(coord < 0)
{
coord = Math.abs(coord);
}
if(coord % (size * 2) >= size)
{
return (size) - (coord % size) - 1;
}
else {
return coord % size;
}
}
default void set(int x, int y, T v)
{
default void set(int x, int y, T v) {
set((zigZag(y, getHeight()) * getWidth()) + zigZag(x, getWidth()), v);
}
default T get(int x, int y)
{
try
{
default T get(int x, int y) {
try {
return get((zigZag(y, getHeight()) * getWidth()) + zigZag(x, getWidth()));
}
catch(Throwable e)
{
} catch (Throwable e) {
e.printStackTrace();
throw e;
}
}
default void iset(int x, int y, int v)
{
default void iset(int x, int y, int v) {
iset((zigZag(y, getHeight()) * getWidth()) + zigZag(x, getWidth()), v);
}
}

View File

@ -31,20 +31,17 @@ public class ByteCache implements ArrayCache<Integer> {
private final int height;
private final byte[] cache;
public ByteCache(int width, int height)
{
public ByteCache(int width, int height) {
this.width = width;
this.height = height;
cache = new byte[width * height];
}
public void set(int i, Integer v)
{
public void set(int i, Integer v) {
cache[i] = v.byteValue();
}
public Integer get(int i)
{
public Integer get(int i) {
return (int) cache[i];
}
@ -53,8 +50,7 @@ public class ByteCache implements ArrayCache<Integer> {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
for (int i = 0; i < width * height; i++) {
dos.writeByte(get(i));
}
}

View File

@ -31,20 +31,17 @@ public abstract class DataBitCache<T> implements ArrayCache<T> {
private final int height;
private final DataContainer<T> cache;
public DataBitCache(int width, int height)
{
public DataBitCache(int width, int height) {
this.width = width;
this.height = height;
cache = new DataContainer<>(this, width * height);
}
public void set(int i, T v)
{
public void set(int i, T v) {
cache.set(i, v);
}
public T get(int i)
{
public T get(int i) {
return cache.get(i);
}

View File

@ -36,27 +36,23 @@ public class FloatCache implements ArrayCache<Float> {
public FloatCache(DataInputStream din) throws IOException {
this(din.readInt(), din.readInt());
for(int i = 0; i < width * height; i++)
{
for (int i = 0; i < width * height; i++) {
cache[i] = din.readFloat();
}
din.close();
}
public FloatCache(int width, int height)
{
public FloatCache(int width, int height) {
this.width = width;
this.height = height;
cache = new float[width * height];
}
public void set(int i, Float v)
{
public void set(int i, Float v) {
cache[i] = v;
}
public Float get(int i)
{
public Float get(int i) {
return cache[i];
}
@ -65,8 +61,7 @@ public class FloatCache implements ArrayCache<Float> {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
for (int i = 0; i < width * height; i++) {
dos.writeFloat(get(i));
}
}

View File

@ -31,20 +31,17 @@ public class IntCache implements ArrayCache<Integer> {
private final int height;
private final int[] cache;
public IntCache(int width, int height)
{
public IntCache(int width, int height) {
this.width = width;
this.height = height;
cache = new int[width * height];
}
public void set(int i, Integer v)
{
public void set(int i, Integer v) {
cache[i] = v;
}
public Integer get(int i)
{
public Integer get(int i) {
return cache[i];
}
@ -53,8 +50,7 @@ public class IntCache implements ArrayCache<Integer> {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
for (int i = 0; i < width * height; i++) {
dos.writeInt(get(i));
}
}

View File

@ -31,20 +31,17 @@ public class ShortCache implements ArrayCache<Short> {
private final int height;
private final short[] cache;
public ShortCache(int width, int height)
{
public ShortCache(int width, int height) {
this.width = width;
this.height = height;
cache = new short[width * height];
}
public void set(int i, Short v)
{
public void set(int i, Short v) {
cache[i] = v;
}
public Short get(int i)
{
public Short get(int i) {
return cache[i];
}
@ -53,8 +50,7 @@ public class ShortCache implements ArrayCache<Short> {
dos.writeInt(width);
dos.writeInt(height);
for(int i = 0; i < width * height; i++)
{
for (int i = 0; i < width * height; i++) {
dos.writeShort(get(i));
}
}

View File

@ -24,10 +24,8 @@ import java.io.Serializable;
/**
* A Biset
*
* @param <A>
* the first object type
* @param <B>
* the second object type
* @param <A> the first object type
* @param <B> the second object type
* @author cyberpwn
*/
@SuppressWarnings("hiding")
@ -39,10 +37,8 @@ public class GBiset<A, B> implements Serializable {
/**
* Create a new Biset
*
* @param a
* the first object
* @param b
* the second object
* @param a the first object
* @param b the second object
*/
public GBiset(A a, B b) {
this.a = a;
@ -61,8 +57,7 @@ public class GBiset<A, B> implements Serializable {
/**
* Set the first object
*
* @param a
* the first object A
* @param a the first object A
*/
public void setA(A a) {
this.a = a;

View File

@ -24,18 +24,15 @@ import java.util.List;
/**
* Adapts a list of objects into a list of other objects
*
* @param <FROM>
* the from object in lists (the item INSIDE the list)
* @param <TO>
* the to object in lists (the item INSIDE the list)
* @param <FROM> the from object in lists (the item INSIDE the list)
* @param <TO> the to object in lists (the item INSIDE the list)
* @author cyberpwn
*/
public abstract class GListAdapter<FROM, TO> {
/**
* Adapts a list of FROM to a list of TO
*
* @param from
* the from list
* @param from the from list
* @return the to list
*/
public List<TO> adapt(List<FROM> from) {
@ -55,8 +52,7 @@ public abstract class GListAdapter<FROM, TO> {
/**
* Adapts a list object FROM to TO for use with the adapt method
*
* @param from
* the from object
* @param from the from object
* @return the to object
*/
public abstract TO onAdapt(FROM from);

View File

@ -113,10 +113,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* returned map. You must specify each key for each value in this list. In the
* function, returning null will not add the keyval pair.
*
* @param <K>
* the inferred key type
* @param f
* the function
* @param <K> the inferred key type
* @param f the function
* @return the new map
*/
public <K> KMap<K, T> asValues(Function<T, K> f) {
@ -130,10 +128,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* returned map. You must specify each value for each key in this list. In the
* function, returning null will not add the keyval pair.
*
* @param <V>
* the inferred value type
* @param f
* the function
* @param <V> the inferred value type
* @param f the function
* @return the new map
*/
public <V> KMap<T, V> asKeys(Function<T, V> f) {
@ -145,8 +141,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Cut this list into targetCount sublists
*
* @param targetCount
* the target count of sublists
* @param targetCount the target count of sublists
* @return the list of sublists
*/
public KList<KList<T>> divide(int targetCount) {
@ -157,8 +152,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* Split this list into a list of sublists with roughly targetSize elements of T
* per sublist
*
* @param targetSize
* the target size
* @param targetSize the target size
* @return the list of sublists
*/
public KList<KList<T>> split(int targetSize) {
@ -186,8 +180,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* Rewrite this list by checking each value and changing the value (or not).
* Return null to remove the element in the function
*
* @param t
* the function
* @param t the function
* @return the same list (not a copy)
*/
public KList<T> rewrite(Function<T, T> t) {
@ -263,8 +256,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Tostring with a seperator for each item in the list
*
* @param split
* the seperator
* @param split the seperator
* @return the string representing this object
*/
public String toString(String split) {
@ -297,12 +289,9 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Add the contents of the given list (v) into this list using a converter
*
* @param <V>
* the type of the forign list
* @param v
* the forign (given) list
* @param converter
* the converter that converts the forign type into this list type
* @param <V> the type of the forign list
* @param v the forign (given) list
* @param converter the converter that converts the forign type into this list type
* @return this list (builder)
*/
public <V> KList<T> addFrom(List<V> v, Function<V, T> converter) {
@ -333,8 +322,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Adds T to the list, ignores if null
*
* @param t
* the value to add
* @param t the value to add
* @return the same list
*/
public KList<T> addNonNull(T t) {
@ -349,10 +337,8 @@ public class KList<T> extends ArrayList<T> implements List<T> {
* Swaps the values of index a and b. For example "hello", "world", "!" swap(1,
* 2) would change the list to "hello", "!", "world"
*
* @param a
* the first index
* @param b
* the second index
* @param a the first index
* @param b the second index
* @return the same list (builder), not a copy
*/
public KList<T> swapIndexes(int a, int b) {
@ -368,8 +354,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Remove a number of elements from the list
*
* @param t
* the elements
* @param t the elements
* @return this list
*/
@SuppressWarnings("unchecked")
@ -384,8 +369,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Add another glist's contents to this one (addall builder)
*
* @param t
* the list
* @param t the list
* @return the same list
*/
public KList<T> add(KList<T> t) {
@ -396,8 +380,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Add a number of values to this list
*
* @param t
* the list
* @param t the list
* @return this list
*/
@SuppressWarnings("unchecked")
@ -412,8 +395,7 @@ public class KList<T> extends ArrayList<T> implements List<T> {
/**
* Check if this list has an index at the given index
*
* @param index
* the given index
* @param index the given index
* @return true if size > index
*/
public boolean hasIndex(int index) {

View File

@ -56,12 +56,9 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
* Puts a value into a map-value-list based on the key such that if GMap<K,
* GList<S>> where V is GList<S>
*
* @param <S>
* the list type in the value type
* @param k
* the key to look for
* @param vs
* the values to put into the list of the given key
* @param <S> the list type in the value type
* @param k the key to look for
* @param vs the values to put into the list of the given key
* @return the same list (builder)
*/
@SuppressWarnings("unchecked")
@ -146,8 +143,7 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Put another map's values into this map
*
* @param m
* the map to insert
* @param m the map to insert
* @return this map (builder)
*/
public KMap<K, V> put(Map<K, V> m) {
@ -167,8 +163,7 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Loop through each keyvalue set (copy of it) with the map parameter
*
* @param f
* the function
* @param f the function
* @return the same gmap
*/
public KMap<K, V> rewrite(Consumer3<K, V, KMap<K, V>> f) {
@ -184,8 +179,7 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Loop through each keyvalue set (copy of it)
*
* @param f
* the function
* @param f the function
* @return the same gmap
*/
public KMap<K, V> each(Consumer2<K, V> f) {
@ -314,10 +308,8 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
/**
* Still works as it normally should except it returns itself (builder)
*
* @param key
* the key
* @param value
* the value (single only supported)
* @param key the key
* @param value the value (single only supported)
*/
public KMap<K, V> qput(K key, V value) {
super.put(key, value);
@ -328,10 +320,8 @@ public class KMap<K, V> extends ConcurrentHashMap<K, V> {
* Works just like put, except it wont put anything unless the key and value are
* nonnull
*
* @param key
* the nonnull key
* @param value
* the nonnull value
* @param key the nonnull key
* @param value the nonnull value
* @return the same map
*/
public KMap<K, V> putNonNull(K key, V value) {

View File

@ -21,10 +21,8 @@ package com.volmit.iris.util.collection;
/**
* Represents a keypair
*
* @param <K>
* the key type
* @param <V>
* the value type
* @param <K> the key type
* @param <V> the value type
* @author cyberpwn
*/
@SuppressWarnings("hiding")
@ -35,10 +33,8 @@ public class KeyPair<K, V> {
/**
* Create a keypair
*
* @param k
* the key
* @param v
* the value
* @param k the key
* @param v the value
*/
public KeyPair(K k, V v) {
this.k = k;

View File

@ -24,6 +24,7 @@ public class ChunkContext {
public ChunkContext(int x, int z, IrisComplex c) {
this(x, z, c, true);
}
@BlockCoordinates
public ChunkContext(int x, int z, IrisComplex c, boolean cache) {
this.x = x;
@ -38,9 +39,7 @@ public class ChunkContext {
fluid = new ChunkedDataCache<>(b, c.getFluidStream(), x, z);
region = new ChunkedDataCache<>(b, c.getRegionStream(), x, z);
b.complete();
}
else {
} else {
height = new ChunkedDataCache<>(null, c.getHeightStream(), x, z, false);
biome = new ChunkedDataCache<>(null, c.getTrueBiomeStream(), x, z, false);
cave = new ChunkedDataCache<>(null, c.getCaveBiomeStream(), x, z, false);

View File

@ -19,6 +19,7 @@ public class ChunkedDataCache<T> {
public ChunkedDataCache(BurstExecutor burst, ProceduralStream<T> stream, int x, int z) {
this(burst, stream, x, z, true);
}
@BlockCoordinates
public ChunkedDataCache(BurstExecutor burst, ProceduralStream<T> stream, int x, int z, boolean cache) {
this.stream = stream;
@ -41,9 +42,7 @@ public class ChunkedDataCache<T> {
});
}
}
}
else {
} else {
data = new Object[0];
}
}

View File

@ -410,8 +410,7 @@ public class B {
try {
String bd = bdxf.trim();
if(!custom.isEmpty() && custom.containsKey(bd))
{
if (!custom.isEmpty() && custom.containsKey(bd)) {
return custom.get(bd);
}

View File

@ -41,10 +41,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Construct a Cuboid given two Location objects which represent any two corners
* of the Cuboid.
*
* @param l1
* one of the corners
* @param l2
* the other corner
* @param l1 one of the corners
* @param l2 the other corner
*/
public Cuboid(Location l1, Location l2) {
if (!l1.getWorld().equals(l2.getWorld())) {
@ -63,8 +61,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Construct a one-block Cuboid at the given Location of the Cuboid.
*
* @param l1
* location of the Cuboid
* @param l1 location of the Cuboid
*/
public Cuboid(Location l1) {
this(l1, l1);
@ -73,8 +70,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Copy constructor.
*
* @param other
* the Cuboid to copy
* @param other the Cuboid to copy
*/
public Cuboid(Cuboid other) {
this(other.getWorld().getName(), other.x1, other.y1, other.z1, other.x2, other.y2, other.z2);
@ -83,20 +79,13 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Construct a Cuboid in the given World and xyz co-ordinates
*
* @param world
* the Cuboid's world
* @param x1
* X co-ordinate of corner 1
* @param y1
* Y co-ordinate of corner 1
* @param z1
* Z co-ordinate of corner 1
* @param x2
* X co-ordinate of corner 2
* @param y2
* Y co-ordinate of corner 2
* @param z2
* Z co-ordinate of corner 2
* @param world the Cuboid's world
* @param x1 X co-ordinate of corner 1
* @param y1 Y co-ordinate of corner 1
* @param z1 Z co-ordinate of corner 1
* @param x2 X co-ordinate of corner 2
* @param y2 Y co-ordinate of corner 2
* @param z2 Z co-ordinate of corner 2
*/
public Cuboid(World world, int x1, int y1, int z1, int x2, int y2, int z2) {
this.worldName = world.getName();
@ -111,20 +100,13 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Construct a Cuboid in the given world name and xyz co-ordinates.
*
* @param worldName
* the Cuboid's world name
* @param x1
* X co-ordinate of corner 1
* @param y1
* Y co-ordinate of corner 1
* @param z1
* Z co-ordinate of corner 1
* @param x2
* X co-ordinate of corner 2
* @param y2
* Y co-ordinate of corner 2
* @param z2
* Z co-ordinate of corner 2
* @param worldName the Cuboid's world name
* @param x1 X co-ordinate of corner 1
* @param y1 Y co-ordinate of corner 1
* @param z1 Z co-ordinate of corner 1
* @param x2 X co-ordinate of corner 2
* @param y2 Y co-ordinate of corner 2
* @param z2 Z co-ordinate of corner 2
*/
private Cuboid(String worldName, int x1, int y1, int z1, int x2, int y2, int z2) {
this.worldName = worldName;
@ -163,10 +145,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Set the locations
*
* @param l1
* a
* @param l2
* b
* @param l1 a
* @param l2 b
*/
public void set(Location l1, Location l2) {
x1 = Math.min(l1.getBlockX(), l2.getBlockX());
@ -230,8 +210,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Get the Cuboid's world.
*
* @return the World object representing this Cuboid's world
* @throws IllegalStateException
* if the world is not loaded
* @throws IllegalStateException if the world is not loaded
*/
public World getWorld() {
World world = Bukkit.getWorld(worldName);
@ -355,10 +334,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* amounts will shrink the Cuboid in the given direction. Shrinking a cuboid's
* face past the opposite face is not an error and will return a valid Cuboid.
*
* @param dir
* the direction in which to expand
* @param amount
* the number of blocks by which to expand
* @param dir the direction in which to expand
* @param amount the number of blocks by which to expand
* @return a new Cuboid expanded by the given direction and amount
*/
public Cuboid expand(CuboidDirection dir, int amount) {
@ -386,10 +363,8 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Shift the Cuboid in the given direction by the given amount.
*
* @param dir
* the direction in which to shift
* @param amount
* the number of blocks by which to shift
* @param dir the direction in which to shift
* @param amount the number of blocks by which to shift
* @return a new Cuboid shifted by the given direction and amount
*/
public Cuboid shift(CuboidDirection dir, int amount) {
@ -399,16 +374,15 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Outset (grow) the Cuboid in the given direction by the given amount.
*
* @param dir
* the direction in which to outset (must be Horizontal, Vertical, or
* @param dir the direction in which to outset (must be Horizontal, Vertical, or
* Both)
* @param amount
* the number of blocks by which to outset
* @param amount the number of blocks by which to outset
* @return a new Cuboid outset by the given direction and amount
*/
public Cuboid outset(CuboidDirection dir, int amount) {
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 Both -> outset(CuboidDirection.Horizontal, amount).outset(CuboidDirection.Vertical, amount);
default -> throw new IllegalArgumentException("invalid direction " + dir);
@ -420,11 +394,9 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Inset (shrink) the Cuboid in the given direction by the given amount.
* Equivalent to calling outset() with a negative amount.
*
* @param dir
* the direction in which to inset (must be Horizontal, Vertical, or
* @param dir the direction in which to inset (must be Horizontal, Vertical, or
* Both)
* @param amount
* the number of blocks by which to inset
* @param amount the number of blocks by which to inset
* @return a new Cuboid inset by the given direction and amount
*/
public Cuboid inset(CuboidDirection dir, int amount) {
@ -434,12 +406,9 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Return true if the point at (x,y,z) is contained within this Cuboid.
*
* @param x
* the X co-ordinate
* @param y
* the Y co-ordinate
* @param z
* the Z co-ordinate
* @param x the X co-ordinate
* @param y the Y co-ordinate
* @param z the Z co-ordinate
* @return true if the given point is within this Cuboid, false otherwise
*/
public boolean contains(int x, int y, int z) {
@ -449,8 +418,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Check if the given Block is contained within this Cuboid.
*
* @param b
* the Block to check for
* @param b the Block to check for
* @return true if the Block is within this Cuboid, false otherwise
*/
public boolean contains(Block b) {
@ -460,8 +428,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Check if the given Location is contained within this Cuboid.
*
* @param l
* the Location to check for
* @param l the Location to check for
* @return true if the Location is within this Cuboid, false otherwise
*/
public boolean contains(Location l) {
@ -510,8 +477,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* no exterior empty space. E.g. a direction of Down will push the top face
* downwards as much as possible.
*
* @param dir
* the direction in which to contract
* @param dir the direction in which to contract
* @return a new Cuboid contracted in the given direction
*/
public Cuboid contract(CuboidDirection dir) {
@ -561,8 +527,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* Get the Cuboid representing the face of this Cuboid. The resulting Cuboid
* will be one block thick in the axis perpendicular to the requested face.
*
* @param dir
* which face of the Cuboid to get
* @param dir which face of the Cuboid to get
* @return the Cuboid representing this Cuboid's requested face
*/
public Cuboid getFace(CuboidDirection dir) {
@ -580,8 +545,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Check if the Cuboid contains only blocks of the given type
*
* @param material
* the material to check for
* @param material the material to check for
* @return true if this Cuboid contains only blocks of the given type
*/
public boolean containsOnly(Material material) {
@ -596,8 +560,7 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Get the Cuboid big enough to hold both this Cuboid and the given one.
*
* @param other
* the other Cuboid to include
* @param other the other Cuboid to include
* @return a new Cuboid large enough to hold this Cuboid and the given Cuboid
*/
public Cuboid getBoundingCuboid(Cuboid other) {
@ -618,12 +581,9 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
/**
* Get a block relative to the lower NE point of the Cuboid.
*
* @param x
* the X co-ordinate
* @param y
* the Y co-ordinate
* @param z
* the Z co-ordinate
* @param x the X co-ordinate
* @param y the Y co-ordinate
* @param z the Z co-ordinate
* @return the block at the given position
*/
public Block getRelativeBlock(int x, int y, int z) {
@ -635,14 +595,10 @@ public class Cuboid implements Iterable<Block>, Cloneable, ConfigurationSerializ
* This version of getRelativeBlock() should be used if being called many times,
* to avoid excessive calls to getWorld().
*
* @param w
* the World
* @param x
* the X co-ordinate
* @param y
* the Y co-ordinate
* @param z
* the Z co-ordinate
* @param w the World
* @param x the X co-ordinate
* @param y the Y co-ordinate
* @param z the Z co-ordinate
* @return the block at the given position
*/
public Block getRelativeBlock(World w, int x, int y, int z) {

View File

@ -31,12 +31,9 @@ public class Dimension {
/**
* Make a dimension
*
* @param width
* width of this (X)
* @param height
* the height (Y)
* @param depth
* the depth (Z)
* @param width width of this (X)
* @param height the height (Y)
* @param depth the depth (Z)
*/
public Dimension(int width, int height, int depth) {
this.width = width;
@ -47,10 +44,8 @@ public class Dimension {
/**
* Make a dimension
*
* @param width
* width of this (X)
* @param height
* the height (Y)
* @param width width of this (X)
* @param height the height (Y)
*/
public Dimension(int width, int height) {
this.width = width;

View File

@ -26,10 +26,10 @@ import com.volmit.iris.util.math.RollingSequence;
public class KCache<K, V> implements MeteredCache {
private final long max;
private CacheLoader<K, V> loader;
private final LoadingCache<K, V> cache;
private final boolean fastDump;
private final RollingSequence msu = new RollingSequence(100);
private CacheLoader<K, V> loader;
public KCache(CacheLoader<K, V> loader, long max) {
this(loader, max, false);

View File

@ -36,10 +36,8 @@ public class MaterialBlock {
/**
* Create a materialblock
*
* @param material
* the material
* @param data
* the data
* @param material the material
* @param data the data
*/
public MaterialBlock(Material material, Byte data) {
this.material = material;

View File

@ -9,14 +9,12 @@ public class Recycler<T> {
private final List<RecycledObject<T>> pool;
private final Supplier<T> factory;
public Recycler(Supplier<T> factory)
{
public Recycler(Supplier<T> factory) {
pool = new CopyOnWriteArrayList<>();
this.factory = factory;
}
public int getFreeObjects()
{
public int getFreeObjects() {
int m = 0;
RecycledObject<T> o;
for (RecycledObject<T> tRecycledObject : pool) {
@ -30,8 +28,7 @@ public class Recycler<T> {
return m;
}
public int getUsedOjects()
{
public int getUsedOjects() {
int m = 0;
RecycledObject<T> o;
for (RecycledObject<T> tRecycledObject : pool) {
@ -45,8 +42,7 @@ public class Recycler<T> {
return m;
}
public void dealloc(T t)
{
public void dealloc(T t) {
RecycledObject<T> o;
for (RecycledObject<T> tRecycledObject : pool) {
@ -58,8 +54,7 @@ public class Recycler<T> {
}
}
public T alloc()
{
public T alloc() {
RecycledObject<T> o;
for (RecycledObject<T> tRecycledObject : pool) {
@ -74,29 +69,23 @@ public class Recycler<T> {
return alloc();
}
public boolean contract()
{
public boolean contract() {
return contract(Math.max(getFreeObjects() / 2, Runtime.getRuntime().availableProcessors()));
}
public boolean contract(int maxFree)
{
public boolean contract(int maxFree) {
int remove = getFreeObjects() - maxFree;
if(remove > 0)
{
if (remove > 0) {
RecycledObject<T> o;
for(int i = pool.size()-1; i > 0; i--)
{
for (int i = pool.size() - 1; i > 0; i--) {
o = pool.get(i);
if(!o.isUsed())
{
if (!o.isUsed()) {
pool.remove(i);
remove--;
if(remove <= 0)
{
if (remove <= 0) {
return true;
}
}
@ -106,10 +95,8 @@ public class Recycler<T> {
return false;
}
public void expand()
{
if(pool.isEmpty())
{
public void expand() {
if (pool.isEmpty()) {
expand(Runtime.getRuntime().availableProcessors());
return;
}
@ -117,54 +104,43 @@ public class Recycler<T> {
expand(getUsedOjects() + Runtime.getRuntime().availableProcessors());
}
public void expand(int by)
{
for(int i = 0; i < by; i++)
{
public void expand(int by) {
for (int i = 0; i < by; i++) {
pool.add(new RecycledObject<>(factory.get()));
}
}
public int size()
{
public int size() {
return pool.size();
}
public void deallocAll()
{
public void deallocAll() {
pool.clear();
}
public static class RecycledObject<T>
{
public static class RecycledObject<T> {
private final T object;
private final AtomicBoolean used;
public RecycledObject(T object)
{
public RecycledObject(T object) {
this.object = object;
used = new AtomicBoolean(false);
}
public T getObject()
{
public T getObject() {
return object;
}
public boolean isUsed()
{
public boolean isUsed() {
return used.get();
}
public void dealloc()
{
public void dealloc() {
used.set(false);
}
public boolean alloc()
{
if(used.get())
{
public boolean alloc() {
if (used.get()) {
return false;
}

View File

@ -44,12 +44,9 @@ public final class Varint {
* encode signed values. If values are known to be nonnegative,
* {@link #writeUnsignedVarLong(long, DataOutput)} should be used.
*
* @param value
* value to encode
* @param out
* to writeNodeData bytes to
* @throws IOException
* if {@link DataOutput} throws {@link IOException}
* @param value value to encode
* @param out to writeNodeData bytes to
* @throws IOException if {@link DataOutput} throws {@link IOException}
*/
public static void writeSignedVarLong(long value, DataOutput out) throws IOException {
// Great trick from http://code.google.com/apis/protocolbuffers/docs/encoding.html#types
@ -63,12 +60,9 @@ public final class Varint {
* If values can be negative, use {@link #writeSignedVarLong(long, DataOutput)}
* instead. This method treats negative input as like a large unsigned value.
*
* @param value
* value to encode
* @param out
* to writeNodeData bytes to
* @throws IOException
* if {@link DataOutput} throws {@link IOException}
* @param value value to encode
* @param out to writeNodeData bytes to
* @throws IOException if {@link DataOutput} throws {@link IOException}
*/
public static void writeUnsignedVarLong(long value, DataOutput out) throws IOException {
while ((value & 0xFFFFFFFFFFFFFF80L) != 0L) {
@ -124,13 +118,10 @@ public final class Varint {
}
/**
* @param in
* to read bytes from
* @param in to read bytes from
* @return decode value
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException
* if variable-length value does not terminate
* @throws IOException if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException if variable-length value does not terminate
* after 9 bytes have been read
* @see #writeSignedVarLong(long, DataOutput)
*/
@ -145,13 +136,10 @@ public final class Varint {
}
/**
* @param in
* to read bytes from
* @param in to read bytes from
* @return decode value
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException
* if variable-length value does not terminate
* @throws IOException if {@link DataInput} throws {@link IOException}
* @throws IllegalArgumentException if variable-length value does not terminate
* after 9 bytes have been read
* @see #writeUnsignedVarLong(long, DataOutput)
*/
@ -170,11 +158,9 @@ public final class Varint {
}
/**
* @throws IllegalArgumentException
* if variable-length value does not terminate
* @throws IllegalArgumentException if variable-length value does not terminate
* after 5 bytes have been read
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @throws IOException if {@link DataInput} throws {@link IOException}
* @see #readSignedVarLong(DataInput)
*/
public static int readSignedVarInt(DataInput in) throws IOException {
@ -188,11 +174,9 @@ public final class Varint {
}
/**
* @throws IllegalArgumentException
* if variable-length value does not terminate
* @throws IllegalArgumentException if variable-length value does not terminate
* after 5 bytes have been read
* @throws IOException
* if {@link DataInput} throws {@link IOException}
* @throws IOException if {@link DataInput} throws {@link IOException}
* @see #readUnsignedVarLong(DataInput)
*/
public static int readUnsignedVarInt(DataInput in) throws IOException {

View File

@ -59,6 +59,31 @@ public class BitStorage {
this(bits, length, (AtomicLongArray) null);
}
public BitStorage(int bits, int length, long[] data) {
this(bits, length, atomic(data));
}
public BitStorage(int bits, int length, AtomicLongArray data) {
Validate.inclusiveBetween(1L, 32L, bits);
this.size = length;
this.bits = bits;
this.mask = (1L << bits) - 1L;
this.valuesPerLong = (char) (64 / bits);
int var3 = 3 * (this.valuesPerLong - 1);
this.divideMul = MAGIC[var3];
this.divideAdd = MAGIC[var3 + 1];
this.divideShift = MAGIC[var3 + 2];
int var4 = (length + this.valuesPerLong - 1) / this.valuesPerLong;
if (data != null) {
if (data.length() != var4) {
throw new RuntimeException("NO!");
}
this.data = data;
} else {
this.data = new AtomicLongArray(var4);
}
}
private static AtomicLongArray atomic(long[] data) {
if (data == null) {
return null;
@ -85,31 +110,6 @@ public class BitStorage {
return d;
}
public BitStorage(int bits, int length, long[] data) {
this(bits, length, atomic(data));
}
public BitStorage(int bits, int length, AtomicLongArray data) {
Validate.inclusiveBetween(1L, 32L, bits);
this.size = length;
this.bits = bits;
this.mask = (1L << bits) - 1L;
this.valuesPerLong = (char) (64 / bits);
int var3 = 3 * (this.valuesPerLong - 1);
this.divideMul = MAGIC[var3];
this.divideAdd = MAGIC[var3 + 1];
this.divideShift = MAGIC[var3 + 2];
int var4 = (length + this.valuesPerLong - 1) / this.valuesPerLong;
if(data != null) {
if(data.length() != var4) {
throw new RuntimeException("NO!");
}
this.data = data;
} else {
this.data = new AtomicLongArray(var4);
}
}
private int cellIndex(int var0) {
long var1 = Integer.toUnsignedLong(this.divideMul);
long var3 = Integer.toUnsignedLong(this.divideAdd);

View File

@ -31,8 +31,7 @@ public enum DecreeOrigin {
/**
* Check if the origin is valid for a sender
*
* @param sender
* The sender to check
* @param sender The sender to check
* @return True if valid for origin
*/
public boolean validFor(VolmitSender sender) {

View File

@ -38,8 +38,7 @@ public interface DecreeParameterHandler<T> {
/**
* Converting the type back to a string (inverse of the {@link #parse(String) parse} method)
*
* @param t
* The input of the designated type to convert to a String
* @param t The input of the designated type to convert to a String
* @return The resulting string
*/
String toString(T t);
@ -47,8 +46,7 @@ public interface DecreeParameterHandler<T> {
/**
* Forces conversion to the designated type before converting to a string using {@link #toString(T t)}
*
* @param t
* The object to convert to string (that should be of this type)
* @param t The object to convert to string (that should be of this type)
* @return The resulting string.
*/
default String toStringForce(Object t) {
@ -58,11 +56,9 @@ public interface DecreeParameterHandler<T> {
/**
* Should parse a String into the designated type
*
* @param in
* The string to parse
* @param in The string to parse
* @return The value extracted from the string, of the designated type
* @throws DecreeParsingException
* Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
*/
default T parse(String in) throws DecreeParsingException {
return parse(in, false);
@ -71,21 +67,17 @@ public interface DecreeParameterHandler<T> {
/**
* Should parse a String into the designated type. You can force it to not throw a whichexception
*
* @param in
* The string to parse
* @param force
* force an option instead of throwing decreewhich
* @param in The string to parse
* @param force force an option instead of throwing decreewhich
* @return The value extracted from the string, of the designated type
* @throws DecreeParsingException
* Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
*/
T parse(String in, boolean force) throws DecreeParsingException;
/**
* Returns whether a certain type is supported by this handler<br>
*
* @param type
* The type to check
* @param type The type to check
* @return True if supported, false if not
*/
boolean supports(Class<?> type);
@ -93,8 +85,7 @@ public interface DecreeParameterHandler<T> {
/**
* The possible entries for the inputted string (support for autocomplete on partial entries)
*
* @param input
* The inputted string to check against
* @param input The inputted string to check against
* @return A {@link KList} of possibilities
*/
default KList<T> getPossibilities(String input) {

View File

@ -113,8 +113,7 @@ public interface DecreeSystem extends CommandExecutor, TabCompleter {
/**
* Get the handler for the specified type
*
* @param type
* The type to handle
* @param type The type to handle
* @return The corresponding {@link DecreeParameterHandler}, or null
*/
static DecreeParameterHandler<?> getHandler(Class<?> type) {

View File

@ -58,8 +58,7 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
/**
* Converting the type back to a string (inverse of the {@link #parse(String) parse} method)
*
* @param entity
* The input of the designated type to convert to a String
* @param entity The input of the designated type to convert to a String
* @return The resulting string
*/
@Override
@ -70,11 +69,9 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
/**
* Should parse a String into the designated type
*
* @param in
* The string to parse
* @param in The string to parse
* @return The value extracted from the string, of the designated type
* @throws DecreeParsingException
* Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
* @throws DecreeParsingException Thrown when the parsing fails (ex: "oop" translated to an integer throws this)
*/
@Override
public IrisEntity parse(String in, boolean force) throws DecreeParsingException {
@ -93,8 +90,7 @@ public class EntityHandler implements DecreeParameterHandler<IrisEntity> {
/**
* Returns whether a certain type is supported by this handler<br>
*
* @param type
* The type to check
* @param type The type to check
* @return True if supported, false if not
*/
@Override

View File

@ -282,10 +282,8 @@ public class VirtualDecreeCommand {
/**
* Maps the input a player typed to the parameters of this command
*
* @param sender
* The sender
* @param in
* The input
* @param sender The sender
* @param in The input
* @return A map of all the parameter names and their values
*/
private KMap<String, Object> map(VolmitSender sender, KList<String> in) {

View File

@ -426,8 +426,7 @@ public enum C {
/**
* Gets the color represented by the specified color code
*
* @param code
* Code to check
* @param code Code to check
* @return Associative {@link org.bukkit.ChatColor} with the given code, or null
* if it doesn't exist
*/
@ -444,8 +443,7 @@ public enum C {
/**
* Gets the color represented by the specified color code
*
* @param code
* Code to check
* @param code Code to check
* @return Associative {@link org.bukkit.ChatColor} with the given code, or null
* if it doesn't exist
*/
@ -464,8 +462,7 @@ public enum C {
/**
* Strips the given message of all color codes
*
* @param input
* String to strip of color
* @param input String to strip of color
* @return A copy of the input string, without any coloring
*/
public static String stripColor(final String input) {
@ -479,8 +476,7 @@ public enum C {
/**
* DyeColor to ChatColor
*
* @param dclr
* the dye color
* @param dclr the dye color
* @return the color
*/
public static C dyeToChat(DyeColor dclr) {
@ -580,10 +576,8 @@ public enum C {
* alternate color code character will only be replaced if it is immediately
* followed by 0-9, A-F, a-f, K-O, k-o, R or r.
*
* @param altColorChar
* The alternate color code character to replace. Ex: {@literal &}
* @param textToTranslate
* Text containing the alternate color code character.
* @param altColorChar The alternate color code character to replace. Ex: {@literal &}
* @param textToTranslate Text containing the alternate color code character.
* @return Text containing the ChatColor.COLOR_CODE color code character.
*/
public static String translateAlternateColorCodes(char altColorChar, String textToTranslate) {
@ -618,8 +612,7 @@ public enum C {
/**
* Gets the ChatColors used at the end of the given input string.
*
* @param input
* Input string to retrieve the colors from.
* @param input Input string to retrieve the colors from.
* @return Any remaining ChatColors to pass onto the next line.
*/
public static String getLastColors(String input) {

View File

@ -65,12 +65,9 @@ public class Form {
/**
* Scroll text
*
* @param smx
* the text
* @param viewport
* the viewport length
* @param time
* the timeline value
* @param smx the text
* @param viewport the viewport length
* @param time the timeline value
*/
public static String scroll(String smx, int viewport, long time) {
String src = Form.repeat(" ", viewport) + smx + Form.repeat(" ", viewport);
@ -85,8 +82,7 @@ public class Form {
/**
* Capitalize the first letter
*
* @param s
* the string
* @param s the string
* @return the capitalized string
*/
public static String capitalize(String s) {
@ -108,8 +104,7 @@ public class Form {
/**
* Capitalize all words in the string
*
* @param s
* the string
* @param s the string
* @return the capitalized string
*/
public static String capitalizeWords(String s) {
@ -125,10 +120,8 @@ public class Form {
/**
* Hard word wrap
*
* @param s
* the words
* @param len
* the length per line
* @param s the words
* @param len the length per line
* @return the wrapped string
*/
public static String wrap(String s, int len) {
@ -138,10 +131,8 @@ public class Form {
/**
* Soft Word wrap
*
* @param s
* the string
* @param len
* the length to wrap
* @param s the string
* @param len the length to wrap
* @return the wrapped string
*/
public static String wrapWords(String s, int len) {
@ -151,14 +142,10 @@ public class Form {
/**
* Wrap words
*
* @param s
* the string
* @param len
* the wrap length
* @param newLineSep
* the new line seperator
* @param soft
* should it be soft wrapped or hard wrapped?
* @param s the string
* @param len the wrap length
* @param newLineSep the new line seperator
* @param soft should it be soft wrapped or hard wrapped?
* @return the wrapped words
*/
public static String wrap(String s, int len, String newLineSep, boolean soft) {
@ -198,16 +185,11 @@ public class Form {
/**
* Wrap words
*
* @param s
* the string
* @param len
* the length
* @param newLineSep
* the new line seperator
* @param soft
* soft or hard wrapping
* @param regex
* the regex
* @param s the string
* @param len the length
* @param newLineSep the new line seperator
* @param soft soft or hard wrapping
* @param regex the regex
* @return the wrapped string
*/
public static String wrap(String s, int len, String newLineSep, boolean soft, String regex) {
@ -284,8 +266,7 @@ public class Form {
/**
* Returns a fancy duration up to Years
*
* @param duration
* the duration in ms
* @param duration the duration in ms
* @return the fancy duration
*/
public static String duration(RollingSequence rollingSequence, long duration) {
@ -353,8 +334,7 @@ public class Form {
/**
* Fixes the minute issue with formatting
*
* @param c
* the calendar
* @param c the calendar
* @return the minute string
*/
public static String fmin(Calendar c) {
@ -369,8 +349,7 @@ public class Form {
/**
* Get a fancy time stamp
*
* @param time
* the stamp in time (ago)
* @param time the stamp in time (ago)
* @return the fancy stamp in time (ago)
*/
public static String ago(long time) {
@ -483,8 +462,7 @@ public class Form {
/**
* Get the suffix for a number i.e. 1st 2nd 3rd
*
* @param i
* the number
* @param i the number
* @return the suffix
*/
public static String numberSuffix(int i) {
@ -499,10 +477,8 @@ public class Form {
* Get a high accuracy but limited range duration (accurate up to a couple
* minutes)
*
* @param ms
* the milliseconds (double)
* @param prec
* the precision (decimal format)
* @param ms the milliseconds (double)
* @param prec the precision (decimal format)
* @return the formatted string
*/
public static String duration(double ms, int prec) {
@ -536,10 +512,8 @@ public class Form {
/**
* Get a duration from milliseconds up to days
*
* @param ms
* the ms
* @param prec
* the precision (decimal format)
* @param ms the ms
* @param prec the precision (decimal format)
* @return the formatted string
*/
public static String duration(long ms, int prec) {
@ -569,8 +543,7 @@ public class Form {
/**
* Format a big value
*
* @param i
* the number
* @param i the number
* @return the full value in string
*/
public static String b(int i) {
@ -580,8 +553,7 @@ public class Form {
/**
* Format a big value
*
* @param i
* the number
* @param i the number
* @return the full value in string
*/
public static String b(long i) {
@ -591,8 +563,7 @@ public class Form {
/**
* Format a big value
*
* @param i
* the number
* @param i the number
* @return the full value in string
*/
public static String b(double i) {
@ -602,8 +573,7 @@ public class Form {
/**
* Format a big number
*
* @param number
* the big number
* @param number the big number
* @return the value in string
*/
public static String b(BigInteger number) {
@ -629,8 +599,7 @@ public class Form {
* Calculate a fancy string representation of a file size. Adds a suffix of B,
* KB, MB, GB, or TB
*
* @param s
* the size (in bytes)
* @param s the size (in bytes)
* @return the string
*/
public static String fileSize(long s) {
@ -640,10 +609,8 @@ public class Form {
/**
* ":", "a", "b", "c" -> a:b:c
*
* @param splitter
* the splitter that goes in between
* @param strings
* the strings
* @param splitter the splitter that goes in between
* @param strings the strings
* @return the result
*/
public static String split(String splitter, String... strings) {
@ -661,8 +628,7 @@ public class Form {
* Calculate a fancy string representation of a file size. Adds a suffix of B,
* KB, MB, GB, or TB
*
* @param s
* the size (in bytes)
* @param s the size (in bytes)
* @return the string
*/
public static String memSize(long s) {
@ -676,8 +642,7 @@ public class Form {
/**
* Get the timestamp of the time t (ms since 1970)
*
* @param t
* the time
* @param t the time
* @return the stamp
*/
@SuppressWarnings("deprecation")
@ -712,10 +677,8 @@ public class Form {
* with a special divisor. The divisor decides how much goes up in the suffix
* chain.
*
* @param s
* the size (in bytes)
* @param div
* the divisor
* @param s the size (in bytes)
* @param div the divisor
* @return the string
*/
public static String ofSize(long s, int div) {
@ -754,12 +717,9 @@ public class Form {
* with a special divisor. The divisor decides how much goes up in the suffix
* chain.
*
* @param s
* the size (in bytes)
* @param div
* the divisor
* @param dec
* the decimal places
* @param s the size (in bytes)
* @param div the divisor
* @param dec the decimal places
* @return the string
*/
public static String ofSize(long s, int div, int dec) {
@ -794,12 +754,9 @@ public class Form {
* with a special divisor. The divisor decides how much goes up in the suffix
* chain.
*
* @param s
* the size (in bytes)
* @param div
* the divisor
* @param dec
* the decimal places
* @param s the size (in bytes)
* @param div the divisor
* @param dec the decimal places
* @return the string
*/
public static String ofSizeMetricWeight(long s, int div, int dec) {
@ -836,10 +793,8 @@ public class Form {
/**
* Trim a string to a length, then append ... at the end if it extends the limit
*
* @param s
* the string
* @param l
* the limit
* @param s the string
* @param l the limit
* @return the modified string
*/
public static String trim(String s, int l) {
@ -854,8 +809,7 @@ public class Form {
* Get a class name into a configuration/filename key For example,
* PhantomController.class is converted to phantom-controller
*
* @param clazz
* the class
* @param clazz the class
* @return the string representation
*/
public static String cname(String clazz) {
@ -879,8 +833,7 @@ public class Form {
/**
* Get a formatted representation of the memory given in megabytes
*
* @param mb
* the megabytes
* @param mb the megabytes
* @return the string representation with suffixes
*/
public static String mem(long mb) {
@ -915,8 +868,7 @@ public class Form {
/**
* Format a long. Changes -10334 into -10,334
*
* @param i
* the number
* @param i the number
* @return the string representation of the number
*/
public static String f(long i) {
@ -927,8 +879,7 @@ public class Form {
/**
* Format a number. Changes -10334 into -10,334
*
* @param i
* the number
* @param i the number
* @return the string representation of the number
*/
public static String f(int i) {
@ -939,10 +890,8 @@ public class Form {
/**
* Formats a double's decimals to a limit
*
* @param i
* the double
* @param p
* the number of decimal places to use
* @param i the double
* @param p the number of decimal places to use
* @return the formated string
*/
public static String f(double i, int p) {
@ -962,10 +911,8 @@ public class Form {
* decimal places that dont need to be placed down. 2.4343 formatted with 6
* decimals gets returned as 2.434300
*
* @param i
* the double
* @param p
* the number of decimal places to use
* @param i the double
* @param p the number of decimal places to use
* @return the formated string
*/
public static String fd(double i, int p) {
@ -983,10 +930,8 @@ public class Form {
/**
* Formats a float's decimals to a limit
*
* @param i
* the float
* @param p
* the number of decimal places to use
* @param i the float
* @param p the number of decimal places to use
* @return the formated string
*/
public static String f(float i, int p) {
@ -1004,8 +949,7 @@ public class Form {
/**
* Formats a double's decimals (one decimal point)
*
* @param i
* the double
* @param i the double
*/
public static String f(double i) {
return f(i, 1);
@ -1014,8 +958,7 @@ public class Form {
/**
* Formats a float's decimals (one decimal point)
*
* @param i
* the float
* @param i the float
*/
public static String f(float i) {
return f(i, 1);
@ -1025,10 +968,8 @@ public class Form {
* Get a percent representation of a double and decimal places (0.53) would
* return 53%
*
* @param i
* the double
* @param p
* the number of decimal points
* @param i the double
* @param p the number of decimal points
* @return a string
*/
public static String pc(double i, int p) {
@ -1039,10 +980,8 @@ public class Form {
* Get a percent representation of a float and decimal places (0.53) would
* return 53%
*
* @param i
* the float
* @param p
* the number of decimal points
* @param i the float
* @param p the number of decimal points
* @return a string
*/
public static String pc(float i, int p) {
@ -1053,8 +992,7 @@ public class Form {
* Get a percent representation of a double and zero decimal places (0.53) would
* return 53%
*
* @param i
* the double
* @param i the double
* @return a string
*/
public static String pc(double i) {
@ -1065,8 +1003,7 @@ public class Form {
* Get a percent representation of a float and zero decimal places (0.53) would
* return 53%
*
* @param i
* the double
* @param i the double
* @return a string
*/
public static String pc(float i) {
@ -1076,12 +1013,9 @@ public class Form {
/**
* Get a percent as the percent of i out of "of" with custom decimal places
*
* @param i
* the percent out of
* @param of
* of of
* @param p
* the decimal places
* @param i the percent out of
* @param of of of
* @param p the decimal places
* @return the string
*/
public static String pc(int i, int of, int p) {
@ -1091,10 +1025,8 @@ public class Form {
/**
* Get a percent as the percent of i out of "of"
*
* @param i
* the percent out of
* @param of
* of of
* @param i the percent out of
* @param of of of
* @return the string
*/
public static String pc(int i, int of) {
@ -1104,12 +1036,9 @@ public class Form {
/**
* Get a percent as the percent of i out of "of" with custom decimal places
*
* @param i
* the percent out of
* @param of
* of of
* @param p
* the decimal places
* @param i the percent out of
* @param of of of
* @param p the decimal places
* @return the string
*/
public static String pc(long i, long of, int p) {
@ -1119,10 +1048,8 @@ public class Form {
/**
* Get a percent as the percent of i out of "of"
*
* @param i
* the percent out of
* @param of
* of of
* @param i the percent out of
* @param of of of
* @return the string
*/
public static String pc(long i, long of) {
@ -1132,8 +1059,7 @@ public class Form {
/**
* Milliseconds to seconds (double)
*
* @param ms
* the milliseconds
* @param ms the milliseconds
* @return a formatted string to milliseconds
*/
public static String msSeconds(long ms) {
@ -1143,10 +1069,8 @@ public class Form {
/**
* Milliseconds to seconds (double) custom decimals
*
* @param ms
* the milliseconds
* @param p
* number of decimal points
* @param ms the milliseconds
* @param p number of decimal points
* @return a formatted string to milliseconds
*/
public static String msSeconds(long ms, int p) {
@ -1165,8 +1089,7 @@ public class Form {
/**
* nanoseconds to seconds (double) custom decimals
*
* @param p
* number of decimal points
* @param p number of decimal points
* @return a formatted string to nanoseconds
*/
public static String nsMs(long ns, int p) {
@ -1176,8 +1099,7 @@ public class Form {
/**
* nanoseconds to seconds (double) custom decimals
*
* @param p
* number of decimal points
* @param p number of decimal points
* @return a formatted string to nanoseconds
*/
public static String nsMsd(long ns, int p) {
@ -1187,8 +1109,7 @@ public class Form {
/**
* Get roman numeral representation of the int
*
* @param num
* the int
* @param num the int
* @return the numerals
*/
public static String toRoman(int num) {
@ -1223,8 +1144,7 @@ public class Form {
/**
* Get the number representation from roman numerals.
*
* @param number
* the roman number
* @param number the roman number
* @return the int representation
*/
public static int fromRoman(String number) {
@ -1292,10 +1212,8 @@ public class Form {
/**
* Repeat a string
*
* @param s
* the string
* @param n
* the amount of times to repeat
* @param s the string
* @param n the amount of times to repeat
* @return the repeated string
*/
@SuppressWarnings("StringRepeatCanBeUsed")

View File

@ -23,15 +23,15 @@ import com.volmit.iris.util.scheduling.ChronoLatch;
import com.volmit.iris.util.scheduling.Looper;
public class MemoryMonitor {
private final ChronoLatch cl;
private final RollingSequence pressureAvg;
private final Runtime runtime;
private Looper looper;
private long usedMemory;
private long garbageMemory;
private long garbageLast;
private long garbageBin;
private long pressure;
private final ChronoLatch cl;
private final RollingSequence pressureAvg;
private final Runtime runtime;
public MemoryMonitor(int sampleDelay) {
this.runtime = Runtime.getRuntime();

View File

@ -50,10 +50,8 @@ public interface Hunk<T> {
* Create a hunk view from a source hunk. This view reads and writes through to
* the source hunk. Its is not a copy.
*
* @param <T>
* the type
* @param src
* the source hunk
* @param <T> the type
* @param src the source hunk
* @return the hunk view
*/
static <T> Hunk<T> view(Hunk<T> src) {
@ -171,12 +169,9 @@ public interface Hunk<T> {
/**
* Creates a new bounding hunk from the given hunks
*
* @param <T>
* the type
* @param factory
* the factory that creates a hunk
* @param hunks
* the hunks
* @param <T> the type
* @param factory the factory that creates a hunk
* @param hunks the hunks
* @return the new bounding hunk
*/
@SafeVarargs
@ -268,20 +263,13 @@ public interface Hunk<T> {
/**
* Create a hunk that is optimized for specific uses
*
* @param w
* width
* @param h
* height
* @param d
* depth
* @param type
* the class type
* @param packed
* if the hunk is generally more than 50% full (non-null nodes)
* @param concurrent
* if this hunk must be thread safe
* @param <T>
* the type
* @param w width
* @param h height
* @param d depth
* @param type the class type
* @param packed if the hunk is generally more than 50% full (non-null nodes)
* @param concurrent if this hunk must be thread safe
* @param <T> the type
* @return the hunk
*/
static <T> Hunk<T> newHunk(int w, int h, int d, Class<T> type, boolean packed, boolean concurrent) {
@ -540,10 +528,8 @@ public interface Hunk<T> {
* hunk.set(hunkX, ?, hunkZ, noise(actualBlockX, ?, actualBlockZ));<br>
* }<br>
*
* @param p
* the predicate
* @param c
* the consumer
* @param p the predicate
* @param c the consumer
* @return this
*/
default Hunk<T> iterateSurfaces2D(Predicate<T> p, Consumer8<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Hunk<T>> c) {
@ -604,12 +590,9 @@ public interface Hunk<T> {
* hunk.set(hunkX, ?, hunkZ, noise(actualBlockX, ?, actualBlockZ));<br>
* }<br>
*
* @param parallelism
* the ideal threads to use on this
* @param p
* the predicate
* @param c
* the consumer
* @param parallelism the ideal threads to use on this
* @param p the predicate
* @param c the consumer
* @return this
*/
default Hunk<T> iterateSurfaces2D(int parallelism, Predicate<T> p, Consumer8<Integer, Integer, Integer, Integer, Integer, Integer, Integer, Hunk<T>> c) {
@ -646,8 +629,7 @@ public interface Hunk<T> {
* <p>
* hunk.set(ax, ?, az, NOISE.get(ax+hx, az+hz));
*
* @param c
* the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @param c the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @return this
*/
default Hunk<T> iterate2DTop(Consumer5<Integer, Integer, Integer, Integer, Hunk<T>> c) {
@ -665,10 +647,8 @@ public interface Hunk<T> {
* <p>
* hunk.set(ax, ?, az, NOISE.get(ax+hx, az+hz));
*
* @param parallelism
* the target parallelism value or 0 to disable
* @param c
* the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @param parallelism the target parallelism value or 0 to disable
* @param c the consumer hunkX, hunkZ, hunkOffsetX, hunkOffsetZ.
* @return this
*/
default Hunk<T> iterate2DTop(int parallelism, Consumer5<Integer, Integer, Integer, Integer, Hunk<T>> c) {
@ -1029,18 +1009,12 @@ public interface Hunk<T> {
/**
* Create a new hunk from a section of this hunk.
*
* @param x1
* The min x (inclusive)
* @param y1
* The min y (inclusive)
* @param z1
* The min z (inclusive)
* @param x2
* The max x (exclusive)
* @param y2
* The max y (exclusive)
* @param z2
* The max z (exclusive)
* @param x1 The min x (inclusive)
* @param y1 The min y (inclusive)
* @param z1 The min z (inclusive)
* @param x2 The max x (exclusive)
* @param y2 The max y (exclusive)
* @param z2 The max z (exclusive)
* @return the new hunk (x2-x1, y2-y1, z2-z1)
*/
default ArrayHunk<T> crop(int x1, int y1, int z1, int x2, int y2, int z2) {
@ -1061,18 +1035,12 @@ public interface Hunk<T> {
* Create a new view of this same hunk from a section of this hunk.
* Modifications are routed to this hunk!
*
* @param x1
* The min x (inclusive)
* @param y1
* The min y (inclusive)
* @param z1
* The min z (inclusive)
* @param x2
* The max x (exclusive)
* @param y2
* The max y (exclusive)
* @param z2
* The max z (exclusive)
* @param x1 The min x (inclusive)
* @param y1 The min y (inclusive)
* @param z1 The min z (inclusive)
* @param x2 The max x (exclusive)
* @param y2 The max y (exclusive)
* @param z2 The max z (exclusive)
* @return the cropped view of this hunk (x2-x1, y2-y1, z2-z1)
*/
default Hunk<T> croppedView(int x1, int y1, int z1, int x2, int y2, int z2) {
@ -1097,20 +1065,13 @@ public interface Hunk<T> {
/**
* Set a region
*
* @param x1
* inclusive 1st x
* @param y1
* inclusive 1st y
* @param z1
* inclusive 1st z
* @param x2
* inclusive 2nd x
* @param y2
* inclusive 2nd y
* @param z2
* inclusive 2nd z
* @param t
* the value to set
* @param x1 inclusive 1st x
* @param y1 inclusive 1st y
* @param z1 inclusive 1st z
* @param x2 inclusive 2nd x
* @param y2 inclusive 2nd y
* @param z2 inclusive 2nd z
* @param t the value to set
*/
default void set(int x1, int y1, int z1, int x2, int y2, int z2, T t) {
for (int i = x1; i <= x2; i++) {
@ -1125,12 +1086,9 @@ public interface Hunk<T> {
/**
* Get the value to the closest valid position
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param x the x
* @param y the y
* @param z the z
* @return the value closest to the border of the hunk
*/
default T getClosest(int x, int y, int z) {
@ -1160,8 +1118,7 @@ public interface Hunk<T> {
/**
* Get a 1 node thick hunk representing the face of this hunk
*
* @param f
* the face
* @param f the face
* @return the hunk view of this hunk
*/
default Hunk<T> viewFace(HunkFace f) {
@ -1188,8 +1145,7 @@ public interface Hunk<T> {
/**
* Crop (copy) a 1 node thick hunk representing the face of this hunk
*
* @param f
* the face
* @param f the face
* @return the hunk copy (face) of this hunk
*/
default Hunk<T> cropFace(HunkFace f) {
@ -1216,18 +1172,13 @@ public interface Hunk<T> {
/**
* Set a value at the given position
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param t
* the value
* @param x the x
* @param y the y
* @param z the z
* @param t the value
*/
default void set(int x, int y, int z, T t) {
if(!contains(x, y, z))
{
if (!contains(x, y, z)) {
Iris.warn("OUT OF BOUNDS " + x + " " + y + " " + z + " in bounds " + getWidth() + " " + getHeight() + " " + getDepth());
return;
}
@ -1258,26 +1209,19 @@ public interface Hunk<T> {
/**
* Set a value at the given position without checking coordinate bounds
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param t
* the value
* @param x the x
* @param y the y
* @param z the z
* @param t the value
*/
void setRaw(int x, int y, int z, T t);
/**
* Get a value at the given position without checking coordinate bounds
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param x the x
* @param y the y
* @param z the z
* @return the value or null
*/
T getRaw(int x, int y, int z);
@ -1285,12 +1229,9 @@ public interface Hunk<T> {
/**
* Get a value at the given position
*
* @param x
* the x
* @param y
* the y
* @param z
* the z
* @param x the x
* @param y the y
* @param z the z
* @return the value or null
*/
default T get(int x, int y, int z) {
@ -1310,14 +1251,10 @@ public interface Hunk<T> {
/**
* Insert a hunk into this one with an offset the inserted hunk
*
* @param offX
* the offset from zero for x
* @param offY
* the offset from zero for y
* @param offZ
* the offset from zero for z
* @param hunk
* the hunk to insert
* @param offX the offset from zero for x
* @param offY the offset from zero for y
* @param offZ the offset from zero for z
* @param hunk the hunk to insert
*/
default void insert(int offX, int offY, int offZ, Hunk<T> hunk) {
insert(offX, offY, offZ, hunk, false);
@ -1330,8 +1267,7 @@ public interface Hunk<T> {
/**
* Insert a hunk into this one
*
* @param hunk
* the hunk to insert
* @param hunk the hunk to insert
*/
default void insert(Hunk<T> hunk) {
insert(0, 0, 0, hunk, false);
@ -1351,10 +1287,8 @@ public interface Hunk<T> {
/**
* Insert a hunk into this one
*
* @param hunk
* the hunk to insert
* @param inverted
* invert the inserted hunk or not
* @param hunk the hunk to insert
* @param inverted invert the inserted hunk or not
*/
default void insert(Hunk<T> hunk, boolean inverted) {
insert(0, 0, 0, hunk, inverted);
@ -1364,16 +1298,11 @@ public interface Hunk<T> {
* Insert a hunk into this one with an offset and possibly inverting the y of
* the inserted hunk
*
* @param offX
* the offset from zero for x
* @param offY
* the offset from zero for y
* @param offZ
* the offset from zero for z
* @param hunk
* the hunk to insert
* @param invertY
* should the inserted hunk be inverted
* @param offX the offset from zero for x
* @param offY the offset from zero for y
* @param offZ the offset from zero for z
* @param hunk the hunk to insert
* @param invertY should the inserted hunk be inverted
*/
default void insert(int offX, int offY, int offZ, Hunk<T> hunk, boolean invertY) {
for (int i = offX; i < offX + hunk.getWidth(); i++) {
@ -1390,16 +1319,11 @@ public interface Hunk<T> {
* already used
* the inserted hunk
*
* @param offX
* the offset from zero for x
* @param offY
* the offset from zero for y
* @param offZ
* the offset from zero for z
* @param hunk
* the hunk to insert
* @param invertY
* should the inserted hunk be inverted
* @param offX the offset from zero for x
* @param offY the offset from zero for y
* @param offZ the offset from zero for z
* @param hunk the hunk to insert
* @param invertY should the inserted hunk be inverted
*/
default void insertSoftly(int offX, int offY, int offZ, Hunk<T> hunk, boolean invertY, Predicate<T> shouldOverwrite) {
for (int i = offX; i < offX + hunk.getWidth(); i++) {
@ -1416,8 +1340,7 @@ public interface Hunk<T> {
/**
* Acts like fill, however if used by a mapped hunk, will simply clear it
*
* @param b
* the data to use for fill
* @param b the data to use for fill
*/
default void empty(T b) {
fill(b);
@ -1426,12 +1349,9 @@ public interface Hunk<T> {
/**
* Take a hunk and scale it up using interpolation
*
* @param scale
* the scale
* @param d
* the interpolation method
* @param interpolated
* the interpolated value converter
* @param scale the scale
* @param d the interpolation method
* @param interpolated the interpolated value converter
* @return the new hunk
*/
default Hunk<T> interpolate3D(double scale, InterpolationMethod3D d, Interpolated<T> interpolated) {
@ -1456,12 +1376,9 @@ public interface Hunk<T> {
* Take a hunk and scale it up using interpolation
* 2D, (using only x and z) assumes the height is 1
*
* @param scale
* the scale
* @param d
* the interpolation method
* @param interpolated
* the interpolated value converter
* @param scale the scale
* @param d the interpolation method
* @param interpolated the interpolated value converter
* @return the new hunk
*/
default Hunk<T> interpolate2D(double scale, InterpolationMethod d, Interpolated<T> interpolated) {
@ -1540,8 +1457,7 @@ public interface Hunk<T> {
return x < getWidth() && x >= 0 && y < getHeight() && y >= 0 && z < getDepth() && z >= 0;
}
default int volume()
{
default int volume() {
return getWidth() * getDepth() * getHeight();
}
}

View File

@ -90,10 +90,6 @@ public class DataBits {
}
}
public String toString() {
return "DBits: " + size + "/" + bits + "[" + data.length() + "]";
}
private static int dataLength(int bits, int length) {
return (length + ((char) (64 / bits)) - 1) / ((char) (64 / bits));
}
@ -108,19 +104,8 @@ public class DataBits {
return a;
}
public DataBits setBits(int newBits) {
if(bits != newBits) {
DataBits newData = new DataBits(newBits, size);
AtomicInteger c = new AtomicInteger(0);
for(int i = 0; i < size; i++) {
newData.set(i, get(i));
}
return newData;
}
return this;
public String toString() {
return "DBits: " + size + "/" + bits + "[" + data.length() + "]";
}
private int cellIndex(int var0) {
@ -172,6 +157,21 @@ public class DataBits {
return bits;
}
public DataBits setBits(int newBits) {
if (bits != newBits) {
DataBits newData = new DataBits(newBits, size);
AtomicInteger c = new AtomicInteger(0);
for (int i = 0; i < size; i++) {
newData.set(i, get(i));
}
return newData;
}
return this;
}
public void getAll(IntConsumer var0) {
int var1 = 0;
for (int i = 0; i < data.length(); i++) {

View File

@ -93,6 +93,30 @@ public class DataContainer<T> {
c.writeDos(dos);
}
private static int[] computeBitLimits() {
int[] m = new int[16];
for (int i = 0; i < m.length; i++) {
m[i] = (int) Math.pow(2, i);
}
return m;
}
protected static int bits(int size) {
if (DataContainer.BIT[INITIAL_BITS] >= size) {
return INITIAL_BITS;
}
for (int i = 0; i < DataContainer.BIT.length; i++) {
if (DataContainer.BIT[i] >= size) {
return i;
}
}
return DataContainer.BIT.length - 1;
}
public DataBits getData() {
return data.get();
}
@ -187,30 +211,6 @@ public class DataContainer<T> {
}
}
private static int[] computeBitLimits() {
int[] m = new int[16];
for(int i = 0; i < m.length; i++) {
m[i] = (int) Math.pow(2, i);
}
return m;
}
protected static int bits(int size) {
if(DataContainer.BIT[INITIAL_BITS] >= size) {
return INITIAL_BITS;
}
for(int i = 0; i < DataContainer.BIT.length; i++) {
if(DataContainer.BIT[i] >= size) {
return i;
}
}
return DataContainer.BIT.length - 1;
}
public int size() {
return getData().getSize();
}

View File

@ -39,16 +39,16 @@ public abstract class PaletteOrHunk<T> extends StorageHunk<T> implements Hunk<T>
return isPalette() ? ((PaletteHunk<T>) hunk).getData() : null;
}
public boolean isPalette() {
return hunk instanceof PaletteHunk;
}
public void setPalette(DataContainer<T> c) {
if (isPalette()) {
((PaletteHunk<T>) hunk).setPalette(c);
}
}
public boolean isPalette() {
return hunk instanceof PaletteHunk;
}
@Override
public void setRaw(int x, int y, int z, T t) {
hunk.setRaw(x, y, z, t);

View File

@ -60,8 +60,7 @@ public class BiomeGridHunkHolder extends AtomicHunk<Biome> {
for (int k = 0; k < getDepth(); k++) {
Biome b = super.getRaw(j, i, k);
if(b != null)
{
if (b != null) {
chunk.setBiome(j, i + minHeight, k, b);
}
}

View File

@ -58,8 +58,7 @@ public class BiomeGridHunkView implements Hunk<Biome> {
public void setRaw(int x, int y, int z, Biome t) {
chunk.setBiome(x, y + minHeight, z, t);
if(y > highest)
{
if (y > highest) {
highest = y;
}
}

View File

@ -74,10 +74,7 @@ public class ChunkDataHunkView implements Hunk<BlockData> {
try {
chunk.setBlock(x, y + chunk.getMinHeight(), z, t);
}
catch(Throwable ignored)
{
} catch (Throwable ignored) {
}
}
@ -87,10 +84,7 @@ public class ChunkDataHunkView implements Hunk<BlockData> {
try {
return chunk.getBlockData(x, y + chunk.getMinHeight(), z);
}
catch(Throwable e)
{
} catch (Throwable e) {
}

View File

@ -50,133 +50,387 @@ private static final float[] MAGIC = {0.0F,1.0F,1.2246469E-16F,-1.0F
public static float getStarcast(float x, float z, float r, float checks, NoiseProvider n) {
if (checks >= 1 && checks <= 128) {
if(checks < 2){return sc1(x,z,r,n);}
if(checks < 3){return sc2(x,z,r,n);}
if(checks < 4){return sc3(x,z,r,n);}
if(checks < 5){return sc4(x,z,r,n);}
if(checks < 6){return sc5(x,z,r,n);}
if(checks < 7){return sc6(x,z,r,n);}
if(checks < 8){return sc7(x,z,r,n);}
if(checks < 9){return sc8(x,z,r,n);}
if(checks < 10){return sc9(x,z,r,n);}
if(checks < 11){return sc10(x,z,r,n);}
if(checks < 12){return sc11(x,z,r,n);}
if(checks < 13){return sc12(x,z,r,n);}
if(checks < 14){return sc13(x,z,r,n);}
if(checks < 15){return sc14(x,z,r,n);}
if(checks < 16){return sc15(x,z,r,n);}
if(checks < 17){return sc16(x,z,r,n);}
if(checks < 18){return sc17(x,z,r,n);}
if(checks < 19){return sc18(x,z,r,n);}
if(checks < 20){return sc19(x,z,r,n);}
if(checks < 21){return sc20(x,z,r,n);}
if(checks < 22){return sc21(x,z,r,n);}
if(checks < 23){return sc22(x,z,r,n);}
if(checks < 24){return sc23(x,z,r,n);}
if(checks < 25){return sc24(x,z,r,n);}
if(checks < 26){return sc25(x,z,r,n);}
if(checks < 27){return sc26(x,z,r,n);}
if(checks < 28){return sc27(x,z,r,n);}
if(checks < 29){return sc28(x,z,r,n);}
if(checks < 30){return sc29(x,z,r,n);}
if(checks < 31){return sc30(x,z,r,n);}
if(checks < 32){return sc31(x,z,r,n);}
if(checks < 33){return sc32(x,z,r,n);}
if(checks < 34){return sc33(x,z,r,n);}
if(checks < 35){return sc34(x,z,r,n);}
if(checks < 36){return sc35(x,z,r,n);}
if(checks < 37){return sc36(x,z,r,n);}
if(checks < 38){return sc37(x,z,r,n);}
if(checks < 39){return sc38(x,z,r,n);}
if(checks < 40){return sc39(x,z,r,n);}
if(checks < 41){return sc40(x,z,r,n);}
if(checks < 42){return sc41(x,z,r,n);}
if(checks < 43){return sc42(x,z,r,n);}
if(checks < 44){return sc43(x,z,r,n);}
if(checks < 45){return sc44(x,z,r,n);}
if(checks < 46){return sc45(x,z,r,n);}
if(checks < 47){return sc46(x,z,r,n);}
if(checks < 48){return sc47(x,z,r,n);}
if(checks < 49){return sc48(x,z,r,n);}
if(checks < 50){return sc49(x,z,r,n);}
if(checks < 51){return sc50(x,z,r,n);}
if(checks < 52){return sc51(x,z,r,n);}
if(checks < 53){return sc52(x,z,r,n);}
if(checks < 54){return sc53(x,z,r,n);}
if(checks < 55){return sc54(x,z,r,n);}
if(checks < 56){return sc55(x,z,r,n);}
if(checks < 57){return sc56(x,z,r,n);}
if(checks < 58){return sc57(x,z,r,n);}
if(checks < 59){return sc58(x,z,r,n);}
if(checks < 60){return sc59(x,z,r,n);}
if(checks < 61){return sc60(x,z,r,n);}
if(checks < 62){return sc61(x,z,r,n);}
if(checks < 63){return sc62(x,z,r,n);}
if(checks < 64){return sc63(x,z,r,n);}
if(checks < 65){return sc64(x,z,r,n);}
if(checks < 66){return sc65(x,z,r,n);}
if(checks < 67){return sc66(x,z,r,n);}
if(checks < 68){return sc67(x,z,r,n);}
if(checks < 69){return sc68(x,z,r,n);}
if(checks < 70){return sc69(x,z,r,n);}
if(checks < 71){return sc70(x,z,r,n);}
if(checks < 72){return sc71(x,z,r,n);}
if(checks < 73){return sc72(x,z,r,n);}
if(checks < 74){return sc73(x,z,r,n);}
if(checks < 75){return sc74(x,z,r,n);}
if(checks < 76){return sc75(x,z,r,n);}
if(checks < 77){return sc76(x,z,r,n);}
if(checks < 78){return sc77(x,z,r,n);}
if(checks < 79){return sc78(x,z,r,n);}
if(checks < 80){return sc79(x,z,r,n);}
if(checks < 81){return sc80(x,z,r,n);}
if(checks < 82){return sc81(x,z,r,n);}
if(checks < 83){return sc82(x,z,r,n);}
if(checks < 84){return sc83(x,z,r,n);}
if(checks < 85){return sc84(x,z,r,n);}
if(checks < 86){return sc85(x,z,r,n);}
if(checks < 87){return sc86(x,z,r,n);}
if(checks < 88){return sc87(x,z,r,n);}
if(checks < 89){return sc88(x,z,r,n);}
if(checks < 90){return sc89(x,z,r,n);}
if(checks < 91){return sc90(x,z,r,n);}
if(checks < 92){return sc91(x,z,r,n);}
if(checks < 93){return sc92(x,z,r,n);}
if(checks < 94){return sc93(x,z,r,n);}
if(checks < 95){return sc94(x,z,r,n);}
if(checks < 96){return sc95(x,z,r,n);}
if(checks < 97){return sc96(x,z,r,n);}
if(checks < 98){return sc97(x,z,r,n);}
if(checks < 99){return sc98(x,z,r,n);}
if(checks < 100){return sc99(x,z,r,n);}
if(checks < 101){return sc100(x,z,r,n);}
if(checks < 102){return sc101(x,z,r,n);}
if(checks < 103){return sc102(x,z,r,n);}
if(checks < 104){return sc103(x,z,r,n);}
if(checks < 105){return sc104(x,z,r,n);}
if(checks < 106){return sc105(x,z,r,n);}
if(checks < 107){return sc106(x,z,r,n);}
if(checks < 108){return sc107(x,z,r,n);}
if(checks < 109){return sc108(x,z,r,n);}
if(checks < 110){return sc109(x,z,r,n);}
if(checks < 111){return sc110(x,z,r,n);}
if(checks < 112){return sc111(x,z,r,n);}
if(checks < 113){return sc112(x,z,r,n);}
if(checks < 114){return sc113(x,z,r,n);}
if(checks < 115){return sc114(x,z,r,n);}
if(checks < 116){return sc115(x,z,r,n);}
if(checks < 117){return sc116(x,z,r,n);}
if(checks < 118){return sc117(x,z,r,n);}
if(checks < 119){return sc118(x,z,r,n);}
if(checks < 120){return sc119(x,z,r,n);}
if(checks < 121){return sc120(x,z,r,n);}
if(checks < 122){return sc121(x,z,r,n);}
if(checks < 123){return sc122(x,z,r,n);}
if(checks < 124){return sc123(x,z,r,n);}
if(checks < 125){return sc124(x,z,r,n);}
if(checks < 126){return sc125(x,z,r,n);}
if(checks < 127){return sc126(x,z,r,n);}
if(checks < 128){return sc127(x,z,r,n);}
if (checks < 2) {
return sc1(x, z, r, n);
}
if (checks < 3) {
return sc2(x, z, r, n);
}
if (checks < 4) {
return sc3(x, z, r, n);
}
if (checks < 5) {
return sc4(x, z, r, n);
}
if (checks < 6) {
return sc5(x, z, r, n);
}
if (checks < 7) {
return sc6(x, z, r, n);
}
if (checks < 8) {
return sc7(x, z, r, n);
}
if (checks < 9) {
return sc8(x, z, r, n);
}
if (checks < 10) {
return sc9(x, z, r, n);
}
if (checks < 11) {
return sc10(x, z, r, n);
}
if (checks < 12) {
return sc11(x, z, r, n);
}
if (checks < 13) {
return sc12(x, z, r, n);
}
if (checks < 14) {
return sc13(x, z, r, n);
}
if (checks < 15) {
return sc14(x, z, r, n);
}
if (checks < 16) {
return sc15(x, z, r, n);
}
if (checks < 17) {
return sc16(x, z, r, n);
}
if (checks < 18) {
return sc17(x, z, r, n);
}
if (checks < 19) {
return sc18(x, z, r, n);
}
if (checks < 20) {
return sc19(x, z, r, n);
}
if (checks < 21) {
return sc20(x, z, r, n);
}
if (checks < 22) {
return sc21(x, z, r, n);
}
if (checks < 23) {
return sc22(x, z, r, n);
}
if (checks < 24) {
return sc23(x, z, r, n);
}
if (checks < 25) {
return sc24(x, z, r, n);
}
if (checks < 26) {
return sc25(x, z, r, n);
}
if (checks < 27) {
return sc26(x, z, r, n);
}
if (checks < 28) {
return sc27(x, z, r, n);
}
if (checks < 29) {
return sc28(x, z, r, n);
}
if (checks < 30) {
return sc29(x, z, r, n);
}
if (checks < 31) {
return sc30(x, z, r, n);
}
if (checks < 32) {
return sc31(x, z, r, n);
}
if (checks < 33) {
return sc32(x, z, r, n);
}
if (checks < 34) {
return sc33(x, z, r, n);
}
if (checks < 35) {
return sc34(x, z, r, n);
}
if (checks < 36) {
return sc35(x, z, r, n);
}
if (checks < 37) {
return sc36(x, z, r, n);
}
if (checks < 38) {
return sc37(x, z, r, n);
}
if (checks < 39) {
return sc38(x, z, r, n);
}
if (checks < 40) {
return sc39(x, z, r, n);
}
if (checks < 41) {
return sc40(x, z, r, n);
}
if (checks < 42) {
return sc41(x, z, r, n);
}
if (checks < 43) {
return sc42(x, z, r, n);
}
if (checks < 44) {
return sc43(x, z, r, n);
}
if (checks < 45) {
return sc44(x, z, r, n);
}
if (checks < 46) {
return sc45(x, z, r, n);
}
if (checks < 47) {
return sc46(x, z, r, n);
}
if (checks < 48) {
return sc47(x, z, r, n);
}
if (checks < 49) {
return sc48(x, z, r, n);
}
if (checks < 50) {
return sc49(x, z, r, n);
}
if (checks < 51) {
return sc50(x, z, r, n);
}
if (checks < 52) {
return sc51(x, z, r, n);
}
if (checks < 53) {
return sc52(x, z, r, n);
}
if (checks < 54) {
return sc53(x, z, r, n);
}
if (checks < 55) {
return sc54(x, z, r, n);
}
if (checks < 56) {
return sc55(x, z, r, n);
}
if (checks < 57) {
return sc56(x, z, r, n);
}
if (checks < 58) {
return sc57(x, z, r, n);
}
if (checks < 59) {
return sc58(x, z, r, n);
}
if (checks < 60) {
return sc59(x, z, r, n);
}
if (checks < 61) {
return sc60(x, z, r, n);
}
if (checks < 62) {
return sc61(x, z, r, n);
}
if (checks < 63) {
return sc62(x, z, r, n);
}
if (checks < 64) {
return sc63(x, z, r, n);
}
if (checks < 65) {
return sc64(x, z, r, n);
}
if (checks < 66) {
return sc65(x, z, r, n);
}
if (checks < 67) {
return sc66(x, z, r, n);
}
if (checks < 68) {
return sc67(x, z, r, n);
}
if (checks < 69) {
return sc68(x, z, r, n);
}
if (checks < 70) {
return sc69(x, z, r, n);
}
if (checks < 71) {
return sc70(x, z, r, n);
}
if (checks < 72) {
return sc71(x, z, r, n);
}
if (checks < 73) {
return sc72(x, z, r, n);
}
if (checks < 74) {
return sc73(x, z, r, n);
}
if (checks < 75) {
return sc74(x, z, r, n);
}
if (checks < 76) {
return sc75(x, z, r, n);
}
if (checks < 77) {
return sc76(x, z, r, n);
}
if (checks < 78) {
return sc77(x, z, r, n);
}
if (checks < 79) {
return sc78(x, z, r, n);
}
if (checks < 80) {
return sc79(x, z, r, n);
}
if (checks < 81) {
return sc80(x, z, r, n);
}
if (checks < 82) {
return sc81(x, z, r, n);
}
if (checks < 83) {
return sc82(x, z, r, n);
}
if (checks < 84) {
return sc83(x, z, r, n);
}
if (checks < 85) {
return sc84(x, z, r, n);
}
if (checks < 86) {
return sc85(x, z, r, n);
}
if (checks < 87) {
return sc86(x, z, r, n);
}
if (checks < 88) {
return sc87(x, z, r, n);
}
if (checks < 89) {
return sc88(x, z, r, n);
}
if (checks < 90) {
return sc89(x, z, r, n);
}
if (checks < 91) {
return sc90(x, z, r, n);
}
if (checks < 92) {
return sc91(x, z, r, n);
}
if (checks < 93) {
return sc92(x, z, r, n);
}
if (checks < 94) {
return sc93(x, z, r, n);
}
if (checks < 95) {
return sc94(x, z, r, n);
}
if (checks < 96) {
return sc95(x, z, r, n);
}
if (checks < 97) {
return sc96(x, z, r, n);
}
if (checks < 98) {
return sc97(x, z, r, n);
}
if (checks < 99) {
return sc98(x, z, r, n);
}
if (checks < 100) {
return sc99(x, z, r, n);
}
if (checks < 101) {
return sc100(x, z, r, n);
}
if (checks < 102) {
return sc101(x, z, r, n);
}
if (checks < 103) {
return sc102(x, z, r, n);
}
if (checks < 104) {
return sc103(x, z, r, n);
}
if (checks < 105) {
return sc104(x, z, r, n);
}
if (checks < 106) {
return sc105(x, z, r, n);
}
if (checks < 107) {
return sc106(x, z, r, n);
}
if (checks < 108) {
return sc107(x, z, r, n);
}
if (checks < 109) {
return sc108(x, z, r, n);
}
if (checks < 110) {
return sc109(x, z, r, n);
}
if (checks < 111) {
return sc110(x, z, r, n);
}
if (checks < 112) {
return sc111(x, z, r, n);
}
if (checks < 113) {
return sc112(x, z, r, n);
}
if (checks < 114) {
return sc113(x, z, r, n);
}
if (checks < 115) {
return sc114(x, z, r, n);
}
if (checks < 116) {
return sc115(x, z, r, n);
}
if (checks < 117) {
return sc116(x, z, r, n);
}
if (checks < 118) {
return sc117(x, z, r, n);
}
if (checks < 119) {
return sc118(x, z, r, n);
}
if (checks < 120) {
return sc119(x, z, r, n);
}
if (checks < 121) {
return sc120(x, z, r, n);
}
if (checks < 122) {
return sc121(x, z, r, n);
}
if (checks < 123) {
return sc122(x, z, r, n);
}
if (checks < 124) {
return sc123(x, z, r, n);
}
if (checks < 125) {
return sc124(x, z, r, n);
}
if (checks < 126) {
return sc125(x, z, r, n);
}
if (checks < 127) {
return sc126(x, z, r, n);
}
if (checks < 128) {
return sc127(x, z, r, n);
}
return sc128(x, z, r, n);
}
@ -193,6 +447,7 @@ float m = 360F / checks;
return v / checks;
}
private static float sc1(float x, float z, float r, NoiseProvider n) {
return (((float) n.noise(x + ((r * MAGIC[1]) - (r * MAGIC[0])), z + ((r * MAGIC[0]) + (r * MAGIC[1]))))) * 1.0F;
}

View File

@ -284,18 +284,37 @@ public class IrisInterpolation {
//@done
}
public static int getRadiusFactor(int coord, double radius)
{
if(radius == 2) {return coord >> 1;}
if(radius == 4) {return coord >> 2;}
if(radius == 8) {return coord >> 3;}
if(radius == 16) {return coord >> 4;}
if(radius == 32) {return coord >> 5;}
if(radius == 64) {return coord >> 6;}
if(radius == 128) {return coord >> 7;}
if(radius == 256) {return coord >> 8;}
if(radius == 512) {return coord >> 9;}
if(radius == 1024) {return coord >> 10;}
public static int getRadiusFactor(int coord, double radius) {
if (radius == 2) {
return coord >> 1;
}
if (radius == 4) {
return coord >> 2;
}
if (radius == 8) {
return coord >> 3;
}
if (radius == 16) {
return coord >> 4;
}
if (radius == 32) {
return coord >> 5;
}
if (radius == 64) {
return coord >> 6;
}
if (radius == 128) {
return coord >> 7;
}
if (radius == 256) {
return coord >> 8;
}
if (radius == 512) {
return coord >> 9;
}
if (radius == 1024) {
return coord >> 10;
}
return (int) Math.floor(coord / radius);
}
@ -921,10 +940,14 @@ public class IrisInterpolation {
case TRISTARCAST_6 -> getStarcast3D(x, y, z, radx, 6D, n);
case TRISTARCAST_9 -> getStarcast3D(x, y, z, radx, 9D, n);
case TRISTARCAST_12 -> getStarcast3D(x, y, z, radx, 12D, n);
case TRILINEAR_TRISTARCAST_3 -> getStarcast3D(x, y, z, radx, 3D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_6 -> getStarcast3D(x, y, z, radx, 6D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_9 -> getStarcast3D(x, y, z, radx, 9D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_12 -> getStarcast3D(x, y, z, radx, 12D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_3 ->
getStarcast3D(x, y, z, radx, 3D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_6 ->
getStarcast3D(x, y, z, radx, 6D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_9 ->
getStarcast3D(x, y, z, radx, 9D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case TRILINEAR_TRISTARCAST_12 ->
getStarcast3D(x, y, z, radx, 12D, (xx, yy, zz) -> getTrilinear((int) xx, (int) yy, (int) zz, radx, rady, radz, n));
case NONE -> n.noise(x, y, z);
};
}
@ -936,28 +959,17 @@ public class IrisInterpolation {
/**
* Get the interpolated 3D noise within a given cuboid size with offsets
*
* @param method
* the interpolation method to use
* @param xo
* the x offset for noise
* @param yo
* the y offset for noise
* @param zo
* the z offset for noise
* @param w
* the width of the result
* @param h
* the height of the result
* @param d
* the depth of the result
* @param radX
* the interpolation radius for the x axis
* @param radY
* the interpolation radius for the y axis
* @param radZ
* the interpolation radius for the z axis
* @param n
* the noise provider
* @param method the interpolation method to use
* @param xo the x offset for noise
* @param yo the y offset for noise
* @param zo the z offset for noise
* @param w the width of the result
* @param h the height of the result
* @param d the depth of the result
* @param radX the interpolation radius for the x axis
* @param radY the interpolation radius for the y axis
* @param radZ the interpolation radius for the z axis
* @param n the noise provider
* @return the resulting hunk of noise
*/
public static Hunk<Double> getNoise3D(InterpolationMethod3D method, int xo, int yo, int zo, int w, int h, int d, double radX, double radY, double radZ, NoiseProvider3 n) {
@ -1042,6 +1054,7 @@ public class IrisInterpolation {
return n.noise(x, z);
}
public static double rangeScale(double amin, double amax, double bmin, double bmax, double b) {
return amin + ((amax - amin) * ((b - bmin) / (bmax - bmin)));
}

View File

@ -21,27 +21,12 @@ package com.volmit.iris.util.interpolation;
import com.volmit.iris.util.function.NoiseProvider;
public class Starcast {
public static double starcast(int x, int z, double r, double checks, boolean optimized, NoiseProvider n) {
return CompiledStarcast.getStarcast((float)x, (float)z, (float)r, (float)checks, n);
}
public static double starcast(int x, int z, double r, double checks, NoiseProvider n) {
return starcast(x, z, r, checks, true, n);
}
private static final double F3C0 = 1;
private static final double F3S0 = 0;
private static final double F3C1 = -0.4999999999999997779553950749686919152736663818359375;
private static final double F3S1 = 0.86602540378443870761060452423407696187496185302734375;
private static final double F3C2 = -0.500000000000000444089209850062616169452667236328125;
private static final double F3S2 = -0.86602540378443837454369713668711483478546142578125;
private static double sc3(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F3C0) - (r * F3S0)), z + ((r * F3S0) + (r * F3C0)))
+ n.noise(x + ((r * F3C1) - (r * F3S1)), z + ((r * F3S1) + (r * F3C1)))
+ n.noise(x + ((r * F3C2) - (r * F3S2)), z + ((r * F3S2) + (r * F3C2)))) / 3.0D;
}
private static final double F5C0 = 1;
private static final double F5S0 = 0;
private static final double F5C1 = 0.30901699437494745126286943559534847736358642578125;
@ -52,15 +37,6 @@ public class Starcast {
private static final double F5S3 = -0.58778525229247302608115433031343854963779449462890625;
private static final double F5C4 = 0.3090169943749472292182645105640403926372528076171875;
private static final double F5S4 = -0.951056516295153642204240895807743072509765625;
private static double sc5(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F5C0) - (r * F5S0)), z + ((r * F5S0) + (r * F5C0)))
+ n.noise(x + ((r * F5C1) - (r * F5S1)), z + ((r * F5S1) + (r * F5C1)))
+ n.noise(x + ((r * F5C2) - (r * F5S2)), z + ((r * F5S2) + (r * F5C2)))
+ n.noise(x + ((r * F5C3) - (r * F5S3)), z + ((r * F5S3) + (r * F5C3)))
+ n.noise(x + ((r * F5C4) - (r * F5S4)), z + ((r * F5S4) + (r * F5C4)))) / 5.0D;
}
private static final double F6C0 = 1;
private static final double F6S0 = 0;
private static final double F6C1 = 0.50000000000000011102230246251565404236316680908203125;
@ -73,16 +49,6 @@ public class Starcast {
private static final double F6S4 = -0.86602540378443837454369713668711483478546142578125;
private static final double F6C5 = 0.50000000000000011102230246251565404236316680908203125;
private static final double F6S5 = -0.8660254037844385965883020617184229195117950439453125;
private static double sc6(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F6C0) - (r * F6S0)), z + ((r * F6S0) + (r * F6C0)))
+ n.noise(x + ((r * F6C1) - (r * F6S1)), z + ((r * F6S1) + (r * F6C1)))
+ n.noise(x + ((r * F6C2) - (r * F6S2)), z + ((r * F6S2) + (r * F6C2)))
+ n.noise(x + ((r * F6C3) - (r * F6S3)), z + ((r * F6S3) + (r * F6C3)))
+ n.noise(x + ((r * F6C4) - (r * F6S4)), z + ((r * F6S4) + (r * F6C4)))
+ n.noise(x + ((r * F6C5) - (r * F6S5)), z + ((r * F6S5) + (r * F6C5)))) / 6.0D;
}
private static final double F7C0 = 1;
private static final double F7S0 = 0;
private static final double F7C1 = 0.6293203910498375019955119569203816354274749755859375;
@ -99,18 +65,6 @@ public class Starcast {
private static final double F7S6 = -0.80901699437494756228517189811100251972675323486328125;
private static final double F7C7 = 0.99862953475457383323288240717374719679355621337890625;
private static final double F7S7 = -0.052335956242944368932423770957029773853719234466552734375;
private static double sc7(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F7C0) - (r * F7S0)), z + ((r * F7S0) + (r * F7C0)))
+ n.noise(x + ((r * F7C1) - (r * F7S1)), z + ((r * F7S1) + (r * F7C1)))
+ n.noise(x + ((r * F7C2) - (r * F7S2)), z + ((r * F7S2) + (r * F7C2)))
+ n.noise(x + ((r * F7C3) - (r * F7S3)), z + ((r * F7S3) + (r * F7C3)))
+ n.noise(x + ((r * F7C4) - (r * F7S4)), z + ((r * F7S4) + (r * F7C4)))
+ n.noise(x + ((r * F7C5) - (r * F7S5)), z + ((r * F7S5) + (r * F7C5)))
+ n.noise(x + ((r * F7C6) - (r * F7S6)), z + ((r * F7S6) + (r * F7C6)))
+ n.noise(x + ((r * F7C7) - (r * F7S7)), z + ((r * F7S7) + (r * F7C7)))) / 7.0D;
}
private static final double F9C0 = 1;
private static final double F9S0 = 0;
private static final double F9C1 = 0.76604444311897801345168090847437269985675811767578125;
@ -129,19 +83,6 @@ public class Starcast {
private static final double F9S7 = -0.98480775301220813133795672911219298839569091796875;
private static final double F9C8 = 0.76604444311897779140707598344306461513042449951171875;
private static final double F9S8 = -0.64278760968653958496332734284806065261363983154296875;
private static double sc9(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F9C0) - (r * F9S0)), z + ((r * F9S0) + (r * F9C0)))
+ n.noise(x + ((r * F9C1) - (r * F9S1)), z + ((r * F9S1) + (r * F9C1)))
+ n.noise(x + ((r * F9C2) - (r * F9S2)), z + ((r * F9S2) + (r * F9C2)))
+ n.noise(x + ((r * F9C3) - (r * F9S3)), z + ((r * F9S3) + (r * F9C3)))
+ n.noise(x + ((r * F9C4) - (r * F9S4)), z + ((r * F9S4) + (r * F9C4)))
+ n.noise(x + ((r * F9C5) - (r * F9S5)), z + ((r * F9S5) + (r * F9C5)))
+ n.noise(x + ((r * F9C6) - (r * F9S6)), z + ((r * F9S6) + (r * F9C6)))
+ n.noise(x + ((r * F9C7) - (r * F9S7)), z + ((r * F9S7) + (r * F9C7)))
+ n.noise(x + ((r * F9C8) - (r * F9S8)), z + ((r * F9S8) + (r * F9C8)))) / 9.0D;
}
private static final double F12C0 = 1;
private static final double F12S0 = 0;
private static final double F12C1 = 0.86602540378443870761060452423407696187496185302734375;
@ -166,22 +107,6 @@ public class Starcast {
private static final double F12S10 = -0.8660254037844385965883020617184229195117950439453125;
private static final double F12C11 = 0.86602540378443837454369713668711483478546142578125;
private static final double F12S11 = -0.500000000000000444089209850062616169452667236328125;
private static double sc12(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F12C0) - (r * F12S0)), z + ((r * F12S0) + (r * F12C0)))
+ n.noise(x + ((r * F12C1) - (r * F12S1)), z + ((r * F12S1) + (r * F12C1)))
+ n.noise(x + ((r * F12C2) - (r * F12S2)), z + ((r * F12S2) + (r * F12C2)))
+ n.noise(x + ((r * F12C3) - (r * F12S3)), z + ((r * F12S3) + (r * F12C3)))
+ n.noise(x + ((r * F12C4) - (r * F12S4)), z + ((r * F12S4) + (r * F12C4)))
+ n.noise(x + ((r * F12C5) - (r * F12S5)), z + ((r * F12S5) + (r * F12C5)))
+ n.noise(x + ((r * F12C6) - (r * F12S6)), z + ((r * F12S6) + (r * F12C6)))
+ n.noise(x + ((r * F12C7) - (r * F12S7)), z + ((r * F12S7) + (r * F12C7)))
+ n.noise(x + ((r * F12C8) - (r * F12S8)), z + ((r * F12S8) + (r * F12C8)))
+ n.noise(x + ((r * F12C9) - (r * F12S9)), z + ((r * F12S9) + (r * F12C9)))
+ n.noise(x + ((r * F12C10) - (r * F12S10)), z + ((r * F12S10) + (r * F12C10)))
+ n.noise(x + ((r * F12C11) - (r * F12S11)), z + ((r * F12S11) + (r * F12C11)))) / 12.0D;
}
private static final double F24C0 = 1;
private static final double F24S0 = 0;
private static final double F24C1 = 0.96592582628906831221371476203785277903079986572265625;
@ -230,34 +155,6 @@ public class Starcast {
private static final double F24S22 = -0.500000000000000444089209850062616169452667236328125;
private static final double F24C23 = 0.96592582628906831221371476203785277903079986572265625;
private static final double F24S23 = -0.258819045102520683965252601410611532628536224365234375;
private static double sc24(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F24C0) - (r * F24S0)), z + ((r * F24S0) + (r * F24C0)))
+ n.noise(x + ((r * F24C1) - (r * F24S1)), z + ((r * F24S1) + (r * F24C1)))
+ n.noise(x + ((r * F24C2) - (r * F24S2)), z + ((r * F24S2) + (r * F24C2)))
+ n.noise(x + ((r * F24C3) - (r * F24S3)), z + ((r * F24S3) + (r * F24C3)))
+ n.noise(x + ((r * F24C4) - (r * F24S4)), z + ((r * F24S4) + (r * F24C4)))
+ n.noise(x + ((r * F24C5) - (r * F24S5)), z + ((r * F24S5) + (r * F24C5)))
+ n.noise(x + ((r * F24C6) - (r * F24S6)), z + ((r * F24S6) + (r * F24C6)))
+ n.noise(x + ((r * F24C7) - (r * F24S7)), z + ((r * F24S7) + (r * F24C7)))
+ n.noise(x + ((r * F24C8) - (r * F24S8)), z + ((r * F24S8) + (r * F24C8)))
+ n.noise(x + ((r * F24C9) - (r * F24S9)), z + ((r * F24S9) + (r * F24C9)))
+ n.noise(x + ((r * F24C10) - (r * F24S10)), z + ((r * F24S10) + (r * F24C10)))
+ n.noise(x + ((r * F24C11) - (r * F24S11)), z + ((r * F24S11) + (r * F24C11)))
+ n.noise(x + ((r * F24C12) - (r * F24S12)), z + ((r * F24S12) + (r * F24C12)))
+ n.noise(x + ((r * F24C13) - (r * F24S13)), z + ((r * F24S13) + (r * F24C13)))
+ n.noise(x + ((r * F24C14) - (r * F24S14)), z + ((r * F24S14) + (r * F24C14)))
+ n.noise(x + ((r * F24C15) - (r * F24S15)), z + ((r * F24S15) + (r * F24C15)))
+ n.noise(x + ((r * F24C16) - (r * F24S16)), z + ((r * F24S16) + (r * F24C16)))
+ n.noise(x + ((r * F24C17) - (r * F24S17)), z + ((r * F24S17) + (r * F24C17)))
+ n.noise(x + ((r * F24C18) - (r * F24S18)), z + ((r * F24S18) + (r * F24C18)))
+ n.noise(x + ((r * F24C19) - (r * F24S19)), z + ((r * F24S19) + (r * F24C19)))
+ n.noise(x + ((r * F24C20) - (r * F24S20)), z + ((r * F24S20) + (r * F24C20)))
+ n.noise(x + ((r * F24C21) - (r * F24S21)), z + ((r * F24S21) + (r * F24C21)))
+ n.noise(x + ((r * F24C22) - (r * F24S22)), z + ((r * F24S22) + (r * F24C22)))
+ n.noise(x + ((r * F24C23) - (r * F24S23)), z + ((r * F24S23) + (r * F24C23)))) / 24.0D;
}
private static final double F32C0 = 1;
private static final double F32S0 = 0;
private static final double F32C1 = 0.9816271834476639757127713892259635031223297119140625;
@ -324,43 +221,6 @@ public class Starcast {
private static final double F32S31 = -0.3255681544571566998769185374840162694454193115234375;
private static final double F32C32 = 0.99026806874157025095684048210387118160724639892578125;
private static final double F32S32 = -0.1391731009600658819369556340461713261902332305908203125;
private static double sc32(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F32C0) - (r * F32S0)), z + ((r * F32S0) + (r * F32C0)))
+ n.noise(x + ((r * F32C1) - (r * F32S1)), z + ((r * F32S1) + (r * F32C1)))
+ n.noise(x + ((r * F32C2) - (r * F32S2)), z + ((r * F32S2) + (r * F32C2)))
+ n.noise(x + ((r * F32C3) - (r * F32S3)), z + ((r * F32S3) + (r * F32C3)))
+ n.noise(x + ((r * F32C4) - (r * F32S4)), z + ((r * F32S4) + (r * F32C4)))
+ n.noise(x + ((r * F32C5) - (r * F32S5)), z + ((r * F32S5) + (r * F32C5)))
+ n.noise(x + ((r * F32C6) - (r * F32S6)), z + ((r * F32S6) + (r * F32C6)))
+ n.noise(x + ((r * F32C7) - (r * F32S7)), z + ((r * F32S7) + (r * F32C7)))
+ n.noise(x + ((r * F32C8) - (r * F32S8)), z + ((r * F32S8) + (r * F32C8)))
+ n.noise(x + ((r * F32C9) - (r * F32S9)), z + ((r * F32S9) + (r * F32C9)))
+ n.noise(x + ((r * F32C10) - (r * F32S10)), z + ((r * F32S10) + (r * F32C10)))
+ n.noise(x + ((r * F32C11) - (r * F32S11)), z + ((r * F32S11) + (r * F32C11)))
+ n.noise(x + ((r * F32C12) - (r * F32S12)), z + ((r * F32S12) + (r * F32C12)))
+ n.noise(x + ((r * F32C13) - (r * F32S13)), z + ((r * F32S13) + (r * F32C13)))
+ n.noise(x + ((r * F32C14) - (r * F32S14)), z + ((r * F32S14) + (r * F32C14)))
+ n.noise(x + ((r * F32C15) - (r * F32S15)), z + ((r * F32S15) + (r * F32C15)))
+ n.noise(x + ((r * F32C16) - (r * F32S16)), z + ((r * F32S16) + (r * F32C16)))
+ n.noise(x + ((r * F32C17) - (r * F32S17)), z + ((r * F32S17) + (r * F32C17)))
+ n.noise(x + ((r * F32C18) - (r * F32S18)), z + ((r * F32S18) + (r * F32C18)))
+ n.noise(x + ((r * F32C19) - (r * F32S19)), z + ((r * F32S19) + (r * F32C19)))
+ n.noise(x + ((r * F32C20) - (r * F32S20)), z + ((r * F32S20) + (r * F32C20)))
+ n.noise(x + ((r * F32C21) - (r * F32S21)), z + ((r * F32S21) + (r * F32C21)))
+ n.noise(x + ((r * F32C22) - (r * F32S22)), z + ((r * F32S22) + (r * F32C22)))
+ n.noise(x + ((r * F32C23) - (r * F32S23)), z + ((r * F32S23) + (r * F32C23)))
+ n.noise(x + ((r * F32C24) - (r * F32S24)), z + ((r * F32S24) + (r * F32C24)))
+ n.noise(x + ((r * F32C25) - (r * F32S25)), z + ((r * F32S25) + (r * F32C25)))
+ n.noise(x + ((r * F32C26) - (r * F32S26)), z + ((r * F32S26) + (r * F32C26)))
+ n.noise(x + ((r * F32C27) - (r * F32S27)), z + ((r * F32S27) + (r * F32C27)))
+ n.noise(x + ((r * F32C28) - (r * F32S28)), z + ((r * F32S28) + (r * F32C28)))
+ n.noise(x + ((r * F32C29) - (r * F32S29)), z + ((r * F32S29) + (r * F32C29)))
+ n.noise(x + ((r * F32C30) - (r * F32S30)), z + ((r * F32S30) + (r * F32C30)))
+ n.noise(x + ((r * F32C31) - (r * F32S31)), z + ((r * F32S31) + (r * F32C31)))
+ n.noise(x + ((r * F32C32) - (r * F32S32)), z + ((r * F32S32) + (r * F32C32)))) / 32.0D;
}
private static final double F48C0 = 1;
private static final double F48S0 = 0;
private static final double F48C1 = 0.99254615164132198312785249072476290166378021240234375;
@ -465,62 +325,6 @@ public class Starcast {
private static final double F48S50 = -0.1736481776669303866977855932418606244027614593505859375;
private static final double F48C51 = 0.99862953475457383323288240717374719679355621337890625;
private static final double F48S51 = -0.052335956242944368932423770957029773853719234466552734375;
private static double sc48(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F48C0) - (r * F48S0)), z + ((r * F48S0) + (r * F48C0)))
+ n.noise(x + ((r * F48C1) - (r * F48S1)), z + ((r * F48S1) + (r * F48C1)))
+ n.noise(x + ((r * F48C2) - (r * F48S2)), z + ((r * F48S2) + (r * F48C2)))
+ n.noise(x + ((r * F48C3) - (r * F48S3)), z + ((r * F48S3) + (r * F48C3)))
+ n.noise(x + ((r * F48C4) - (r * F48S4)), z + ((r * F48S4) + (r * F48C4)))
+ n.noise(x + ((r * F48C5) - (r * F48S5)), z + ((r * F48S5) + (r * F48C5)))
+ n.noise(x + ((r * F48C6) - (r * F48S6)), z + ((r * F48S6) + (r * F48C6)))
+ n.noise(x + ((r * F48C7) - (r * F48S7)), z + ((r * F48S7) + (r * F48C7)))
+ n.noise(x + ((r * F48C8) - (r * F48S8)), z + ((r * F48S8) + (r * F48C8)))
+ n.noise(x + ((r * F48C9) - (r * F48S9)), z + ((r * F48S9) + (r * F48C9)))
+ n.noise(x + ((r * F48C10) - (r * F48S10)), z + ((r * F48S10) + (r * F48C10)))
+ n.noise(x + ((r * F48C11) - (r * F48S11)), z + ((r * F48S11) + (r * F48C11)))
+ n.noise(x + ((r * F48C12) - (r * F48S12)), z + ((r * F48S12) + (r * F48C12)))
+ n.noise(x + ((r * F48C13) - (r * F48S13)), z + ((r * F48S13) + (r * F48C13)))
+ n.noise(x + ((r * F48C14) - (r * F48S14)), z + ((r * F48S14) + (r * F48C14)))
+ n.noise(x + ((r * F48C15) - (r * F48S15)), z + ((r * F48S15) + (r * F48C15)))
+ n.noise(x + ((r * F48C16) - (r * F48S16)), z + ((r * F48S16) + (r * F48C16)))
+ n.noise(x + ((r * F48C17) - (r * F48S17)), z + ((r * F48S17) + (r * F48C17)))
+ n.noise(x + ((r * F48C18) - (r * F48S18)), z + ((r * F48S18) + (r * F48C18)))
+ n.noise(x + ((r * F48C19) - (r * F48S19)), z + ((r * F48S19) + (r * F48C19)))
+ n.noise(x + ((r * F48C20) - (r * F48S20)), z + ((r * F48S20) + (r * F48C20)))
+ n.noise(x + ((r * F48C21) - (r * F48S21)), z + ((r * F48S21) + (r * F48C21)))
+ n.noise(x + ((r * F48C22) - (r * F48S22)), z + ((r * F48S22) + (r * F48C22)))
+ n.noise(x + ((r * F48C23) - (r * F48S23)), z + ((r * F48S23) + (r * F48C23)))
+ n.noise(x + ((r * F48C24) - (r * F48S24)), z + ((r * F48S24) + (r * F48C24)))
+ n.noise(x + ((r * F48C25) - (r * F48S25)), z + ((r * F48S25) + (r * F48C25)))
+ n.noise(x + ((r * F48C26) - (r * F48S26)), z + ((r * F48S26) + (r * F48C26)))
+ n.noise(x + ((r * F48C27) - (r * F48S27)), z + ((r * F48S27) + (r * F48C27)))
+ n.noise(x + ((r * F48C28) - (r * F48S28)), z + ((r * F48S28) + (r * F48C28)))
+ n.noise(x + ((r * F48C29) - (r * F48S29)), z + ((r * F48S29) + (r * F48C29)))
+ n.noise(x + ((r * F48C30) - (r * F48S30)), z + ((r * F48S30) + (r * F48C30)))
+ n.noise(x + ((r * F48C31) - (r * F48S31)), z + ((r * F48S31) + (r * F48C31)))
+ n.noise(x + ((r * F48C32) - (r * F48S32)), z + ((r * F48S32) + (r * F48C32)))
+ n.noise(x + ((r * F48C33) - (r * F48S33)), z + ((r * F48S33) + (r * F48C33)))
+ n.noise(x + ((r * F48C34) - (r * F48S34)), z + ((r * F48S34) + (r * F48C34)))
+ n.noise(x + ((r * F48C35) - (r * F48S35)), z + ((r * F48S35) + (r * F48C35)))
+ n.noise(x + ((r * F48C36) - (r * F48S36)), z + ((r * F48S36) + (r * F48C36)))
+ n.noise(x + ((r * F48C37) - (r * F48S37)), z + ((r * F48S37) + (r * F48C37)))
+ n.noise(x + ((r * F48C38) - (r * F48S38)), z + ((r * F48S38) + (r * F48C38)))
+ n.noise(x + ((r * F48C39) - (r * F48S39)), z + ((r * F48S39) + (r * F48C39)))
+ n.noise(x + ((r * F48C40) - (r * F48S40)), z + ((r * F48S40) + (r * F48C40)))
+ n.noise(x + ((r * F48C41) - (r * F48S41)), z + ((r * F48S41) + (r * F48C41)))
+ n.noise(x + ((r * F48C42) - (r * F48S42)), z + ((r * F48S42) + (r * F48C42)))
+ n.noise(x + ((r * F48C43) - (r * F48S43)), z + ((r * F48S43) + (r * F48C43)))
+ n.noise(x + ((r * F48C44) - (r * F48S44)), z + ((r * F48S44) + (r * F48C44)))
+ n.noise(x + ((r * F48C45) - (r * F48S45)), z + ((r * F48S45) + (r * F48C45)))
+ n.noise(x + ((r * F48C46) - (r * F48S46)), z + ((r * F48S46) + (r * F48C46)))
+ n.noise(x + ((r * F48C47) - (r * F48S47)), z + ((r * F48S47) + (r * F48C47)))
+ n.noise(x + ((r * F48C48) - (r * F48S48)), z + ((r * F48S48) + (r * F48C48)))
+ n.noise(x + ((r * F48C49) - (r * F48S49)), z + ((r * F48S49) + (r * F48C49)))
+ n.noise(x + ((r * F48C50) - (r * F48S50)), z + ((r * F48S50) + (r * F48C50)))
+ n.noise(x + ((r * F48C51) - (r * F48S51)), z + ((r * F48S51) + (r * F48C51)))) / 48.0D;
}
private static final double F64C0 = 1;
private static final double F64S0 = 0;
private static final double F64C1 = 0.9961946980917455451987052583717741072177886962890625;
@ -666,6 +470,193 @@ public class Starcast {
private static final double F64C71 = 0.9961946980917455451987052583717741072177886962890625;
private static final double F64S71 = -0.08715574274765831852551656311334227211773395538330078125;
public static double starcast(int x, int z, double r, double checks, boolean optimized, NoiseProvider n) {
return CompiledStarcast.getStarcast((float) x, (float) z, (float) r, (float) checks, n);
}
public static double starcast(int x, int z, double r, double checks, NoiseProvider n) {
return starcast(x, z, r, checks, true, n);
}
private static double sc3(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F3C0) - (r * F3S0)), z + ((r * F3S0) + (r * F3C0)))
+ n.noise(x + ((r * F3C1) - (r * F3S1)), z + ((r * F3S1) + (r * F3C1)))
+ n.noise(x + ((r * F3C2) - (r * F3S2)), z + ((r * F3S2) + (r * F3C2)))) / 3.0D;
}
private static double sc5(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F5C0) - (r * F5S0)), z + ((r * F5S0) + (r * F5C0)))
+ n.noise(x + ((r * F5C1) - (r * F5S1)), z + ((r * F5S1) + (r * F5C1)))
+ n.noise(x + ((r * F5C2) - (r * F5S2)), z + ((r * F5S2) + (r * F5C2)))
+ n.noise(x + ((r * F5C3) - (r * F5S3)), z + ((r * F5S3) + (r * F5C3)))
+ n.noise(x + ((r * F5C4) - (r * F5S4)), z + ((r * F5S4) + (r * F5C4)))) / 5.0D;
}
private static double sc6(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F6C0) - (r * F6S0)), z + ((r * F6S0) + (r * F6C0)))
+ n.noise(x + ((r * F6C1) - (r * F6S1)), z + ((r * F6S1) + (r * F6C1)))
+ n.noise(x + ((r * F6C2) - (r * F6S2)), z + ((r * F6S2) + (r * F6C2)))
+ n.noise(x + ((r * F6C3) - (r * F6S3)), z + ((r * F6S3) + (r * F6C3)))
+ n.noise(x + ((r * F6C4) - (r * F6S4)), z + ((r * F6S4) + (r * F6C4)))
+ n.noise(x + ((r * F6C5) - (r * F6S5)), z + ((r * F6S5) + (r * F6C5)))) / 6.0D;
}
private static double sc7(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F7C0) - (r * F7S0)), z + ((r * F7S0) + (r * F7C0)))
+ n.noise(x + ((r * F7C1) - (r * F7S1)), z + ((r * F7S1) + (r * F7C1)))
+ n.noise(x + ((r * F7C2) - (r * F7S2)), z + ((r * F7S2) + (r * F7C2)))
+ n.noise(x + ((r * F7C3) - (r * F7S3)), z + ((r * F7S3) + (r * F7C3)))
+ n.noise(x + ((r * F7C4) - (r * F7S4)), z + ((r * F7S4) + (r * F7C4)))
+ n.noise(x + ((r * F7C5) - (r * F7S5)), z + ((r * F7S5) + (r * F7C5)))
+ n.noise(x + ((r * F7C6) - (r * F7S6)), z + ((r * F7S6) + (r * F7C6)))
+ n.noise(x + ((r * F7C7) - (r * F7S7)), z + ((r * F7S7) + (r * F7C7)))) / 7.0D;
}
private static double sc9(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F9C0) - (r * F9S0)), z + ((r * F9S0) + (r * F9C0)))
+ n.noise(x + ((r * F9C1) - (r * F9S1)), z + ((r * F9S1) + (r * F9C1)))
+ n.noise(x + ((r * F9C2) - (r * F9S2)), z + ((r * F9S2) + (r * F9C2)))
+ n.noise(x + ((r * F9C3) - (r * F9S3)), z + ((r * F9S3) + (r * F9C3)))
+ n.noise(x + ((r * F9C4) - (r * F9S4)), z + ((r * F9S4) + (r * F9C4)))
+ n.noise(x + ((r * F9C5) - (r * F9S5)), z + ((r * F9S5) + (r * F9C5)))
+ n.noise(x + ((r * F9C6) - (r * F9S6)), z + ((r * F9S6) + (r * F9C6)))
+ n.noise(x + ((r * F9C7) - (r * F9S7)), z + ((r * F9S7) + (r * F9C7)))
+ n.noise(x + ((r * F9C8) - (r * F9S8)), z + ((r * F9S8) + (r * F9C8)))) / 9.0D;
}
private static double sc12(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F12C0) - (r * F12S0)), z + ((r * F12S0) + (r * F12C0)))
+ n.noise(x + ((r * F12C1) - (r * F12S1)), z + ((r * F12S1) + (r * F12C1)))
+ n.noise(x + ((r * F12C2) - (r * F12S2)), z + ((r * F12S2) + (r * F12C2)))
+ n.noise(x + ((r * F12C3) - (r * F12S3)), z + ((r * F12S3) + (r * F12C3)))
+ n.noise(x + ((r * F12C4) - (r * F12S4)), z + ((r * F12S4) + (r * F12C4)))
+ n.noise(x + ((r * F12C5) - (r * F12S5)), z + ((r * F12S5) + (r * F12C5)))
+ n.noise(x + ((r * F12C6) - (r * F12S6)), z + ((r * F12S6) + (r * F12C6)))
+ n.noise(x + ((r * F12C7) - (r * F12S7)), z + ((r * F12S7) + (r * F12C7)))
+ n.noise(x + ((r * F12C8) - (r * F12S8)), z + ((r * F12S8) + (r * F12C8)))
+ n.noise(x + ((r * F12C9) - (r * F12S9)), z + ((r * F12S9) + (r * F12C9)))
+ n.noise(x + ((r * F12C10) - (r * F12S10)), z + ((r * F12S10) + (r * F12C10)))
+ n.noise(x + ((r * F12C11) - (r * F12S11)), z + ((r * F12S11) + (r * F12C11)))) / 12.0D;
}
private static double sc24(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F24C0) - (r * F24S0)), z + ((r * F24S0) + (r * F24C0)))
+ n.noise(x + ((r * F24C1) - (r * F24S1)), z + ((r * F24S1) + (r * F24C1)))
+ n.noise(x + ((r * F24C2) - (r * F24S2)), z + ((r * F24S2) + (r * F24C2)))
+ n.noise(x + ((r * F24C3) - (r * F24S3)), z + ((r * F24S3) + (r * F24C3)))
+ n.noise(x + ((r * F24C4) - (r * F24S4)), z + ((r * F24S4) + (r * F24C4)))
+ n.noise(x + ((r * F24C5) - (r * F24S5)), z + ((r * F24S5) + (r * F24C5)))
+ n.noise(x + ((r * F24C6) - (r * F24S6)), z + ((r * F24S6) + (r * F24C6)))
+ n.noise(x + ((r * F24C7) - (r * F24S7)), z + ((r * F24S7) + (r * F24C7)))
+ n.noise(x + ((r * F24C8) - (r * F24S8)), z + ((r * F24S8) + (r * F24C8)))
+ n.noise(x + ((r * F24C9) - (r * F24S9)), z + ((r * F24S9) + (r * F24C9)))
+ n.noise(x + ((r * F24C10) - (r * F24S10)), z + ((r * F24S10) + (r * F24C10)))
+ n.noise(x + ((r * F24C11) - (r * F24S11)), z + ((r * F24S11) + (r * F24C11)))
+ n.noise(x + ((r * F24C12) - (r * F24S12)), z + ((r * F24S12) + (r * F24C12)))
+ n.noise(x + ((r * F24C13) - (r * F24S13)), z + ((r * F24S13) + (r * F24C13)))
+ n.noise(x + ((r * F24C14) - (r * F24S14)), z + ((r * F24S14) + (r * F24C14)))
+ n.noise(x + ((r * F24C15) - (r * F24S15)), z + ((r * F24S15) + (r * F24C15)))
+ n.noise(x + ((r * F24C16) - (r * F24S16)), z + ((r * F24S16) + (r * F24C16)))
+ n.noise(x + ((r * F24C17) - (r * F24S17)), z + ((r * F24S17) + (r * F24C17)))
+ n.noise(x + ((r * F24C18) - (r * F24S18)), z + ((r * F24S18) + (r * F24C18)))
+ n.noise(x + ((r * F24C19) - (r * F24S19)), z + ((r * F24S19) + (r * F24C19)))
+ n.noise(x + ((r * F24C20) - (r * F24S20)), z + ((r * F24S20) + (r * F24C20)))
+ n.noise(x + ((r * F24C21) - (r * F24S21)), z + ((r * F24S21) + (r * F24C21)))
+ n.noise(x + ((r * F24C22) - (r * F24S22)), z + ((r * F24S22) + (r * F24C22)))
+ n.noise(x + ((r * F24C23) - (r * F24S23)), z + ((r * F24S23) + (r * F24C23)))) / 24.0D;
}
private static double sc32(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F32C0) - (r * F32S0)), z + ((r * F32S0) + (r * F32C0)))
+ n.noise(x + ((r * F32C1) - (r * F32S1)), z + ((r * F32S1) + (r * F32C1)))
+ n.noise(x + ((r * F32C2) - (r * F32S2)), z + ((r * F32S2) + (r * F32C2)))
+ n.noise(x + ((r * F32C3) - (r * F32S3)), z + ((r * F32S3) + (r * F32C3)))
+ n.noise(x + ((r * F32C4) - (r * F32S4)), z + ((r * F32S4) + (r * F32C4)))
+ n.noise(x + ((r * F32C5) - (r * F32S5)), z + ((r * F32S5) + (r * F32C5)))
+ n.noise(x + ((r * F32C6) - (r * F32S6)), z + ((r * F32S6) + (r * F32C6)))
+ n.noise(x + ((r * F32C7) - (r * F32S7)), z + ((r * F32S7) + (r * F32C7)))
+ n.noise(x + ((r * F32C8) - (r * F32S8)), z + ((r * F32S8) + (r * F32C8)))
+ n.noise(x + ((r * F32C9) - (r * F32S9)), z + ((r * F32S9) + (r * F32C9)))
+ n.noise(x + ((r * F32C10) - (r * F32S10)), z + ((r * F32S10) + (r * F32C10)))
+ n.noise(x + ((r * F32C11) - (r * F32S11)), z + ((r * F32S11) + (r * F32C11)))
+ n.noise(x + ((r * F32C12) - (r * F32S12)), z + ((r * F32S12) + (r * F32C12)))
+ n.noise(x + ((r * F32C13) - (r * F32S13)), z + ((r * F32S13) + (r * F32C13)))
+ n.noise(x + ((r * F32C14) - (r * F32S14)), z + ((r * F32S14) + (r * F32C14)))
+ n.noise(x + ((r * F32C15) - (r * F32S15)), z + ((r * F32S15) + (r * F32C15)))
+ n.noise(x + ((r * F32C16) - (r * F32S16)), z + ((r * F32S16) + (r * F32C16)))
+ n.noise(x + ((r * F32C17) - (r * F32S17)), z + ((r * F32S17) + (r * F32C17)))
+ n.noise(x + ((r * F32C18) - (r * F32S18)), z + ((r * F32S18) + (r * F32C18)))
+ n.noise(x + ((r * F32C19) - (r * F32S19)), z + ((r * F32S19) + (r * F32C19)))
+ n.noise(x + ((r * F32C20) - (r * F32S20)), z + ((r * F32S20) + (r * F32C20)))
+ n.noise(x + ((r * F32C21) - (r * F32S21)), z + ((r * F32S21) + (r * F32C21)))
+ n.noise(x + ((r * F32C22) - (r * F32S22)), z + ((r * F32S22) + (r * F32C22)))
+ n.noise(x + ((r * F32C23) - (r * F32S23)), z + ((r * F32S23) + (r * F32C23)))
+ n.noise(x + ((r * F32C24) - (r * F32S24)), z + ((r * F32S24) + (r * F32C24)))
+ n.noise(x + ((r * F32C25) - (r * F32S25)), z + ((r * F32S25) + (r * F32C25)))
+ n.noise(x + ((r * F32C26) - (r * F32S26)), z + ((r * F32S26) + (r * F32C26)))
+ n.noise(x + ((r * F32C27) - (r * F32S27)), z + ((r * F32S27) + (r * F32C27)))
+ n.noise(x + ((r * F32C28) - (r * F32S28)), z + ((r * F32S28) + (r * F32C28)))
+ n.noise(x + ((r * F32C29) - (r * F32S29)), z + ((r * F32S29) + (r * F32C29)))
+ n.noise(x + ((r * F32C30) - (r * F32S30)), z + ((r * F32S30) + (r * F32C30)))
+ n.noise(x + ((r * F32C31) - (r * F32S31)), z + ((r * F32S31) + (r * F32C31)))
+ n.noise(x + ((r * F32C32) - (r * F32S32)), z + ((r * F32S32) + (r * F32C32)))) / 32.0D;
}
private static double sc48(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F48C0) - (r * F48S0)), z + ((r * F48S0) + (r * F48C0)))
+ n.noise(x + ((r * F48C1) - (r * F48S1)), z + ((r * F48S1) + (r * F48C1)))
+ n.noise(x + ((r * F48C2) - (r * F48S2)), z + ((r * F48S2) + (r * F48C2)))
+ n.noise(x + ((r * F48C3) - (r * F48S3)), z + ((r * F48S3) + (r * F48C3)))
+ n.noise(x + ((r * F48C4) - (r * F48S4)), z + ((r * F48S4) + (r * F48C4)))
+ n.noise(x + ((r * F48C5) - (r * F48S5)), z + ((r * F48S5) + (r * F48C5)))
+ n.noise(x + ((r * F48C6) - (r * F48S6)), z + ((r * F48S6) + (r * F48C6)))
+ n.noise(x + ((r * F48C7) - (r * F48S7)), z + ((r * F48S7) + (r * F48C7)))
+ n.noise(x + ((r * F48C8) - (r * F48S8)), z + ((r * F48S8) + (r * F48C8)))
+ n.noise(x + ((r * F48C9) - (r * F48S9)), z + ((r * F48S9) + (r * F48C9)))
+ n.noise(x + ((r * F48C10) - (r * F48S10)), z + ((r * F48S10) + (r * F48C10)))
+ n.noise(x + ((r * F48C11) - (r * F48S11)), z + ((r * F48S11) + (r * F48C11)))
+ n.noise(x + ((r * F48C12) - (r * F48S12)), z + ((r * F48S12) + (r * F48C12)))
+ n.noise(x + ((r * F48C13) - (r * F48S13)), z + ((r * F48S13) + (r * F48C13)))
+ n.noise(x + ((r * F48C14) - (r * F48S14)), z + ((r * F48S14) + (r * F48C14)))
+ n.noise(x + ((r * F48C15) - (r * F48S15)), z + ((r * F48S15) + (r * F48C15)))
+ n.noise(x + ((r * F48C16) - (r * F48S16)), z + ((r * F48S16) + (r * F48C16)))
+ n.noise(x + ((r * F48C17) - (r * F48S17)), z + ((r * F48S17) + (r * F48C17)))
+ n.noise(x + ((r * F48C18) - (r * F48S18)), z + ((r * F48S18) + (r * F48C18)))
+ n.noise(x + ((r * F48C19) - (r * F48S19)), z + ((r * F48S19) + (r * F48C19)))
+ n.noise(x + ((r * F48C20) - (r * F48S20)), z + ((r * F48S20) + (r * F48C20)))
+ n.noise(x + ((r * F48C21) - (r * F48S21)), z + ((r * F48S21) + (r * F48C21)))
+ n.noise(x + ((r * F48C22) - (r * F48S22)), z + ((r * F48S22) + (r * F48C22)))
+ n.noise(x + ((r * F48C23) - (r * F48S23)), z + ((r * F48S23) + (r * F48C23)))
+ n.noise(x + ((r * F48C24) - (r * F48S24)), z + ((r * F48S24) + (r * F48C24)))
+ n.noise(x + ((r * F48C25) - (r * F48S25)), z + ((r * F48S25) + (r * F48C25)))
+ n.noise(x + ((r * F48C26) - (r * F48S26)), z + ((r * F48S26) + (r * F48C26)))
+ n.noise(x + ((r * F48C27) - (r * F48S27)), z + ((r * F48S27) + (r * F48C27)))
+ n.noise(x + ((r * F48C28) - (r * F48S28)), z + ((r * F48S28) + (r * F48C28)))
+ n.noise(x + ((r * F48C29) - (r * F48S29)), z + ((r * F48S29) + (r * F48C29)))
+ n.noise(x + ((r * F48C30) - (r * F48S30)), z + ((r * F48S30) + (r * F48C30)))
+ n.noise(x + ((r * F48C31) - (r * F48S31)), z + ((r * F48S31) + (r * F48C31)))
+ n.noise(x + ((r * F48C32) - (r * F48S32)), z + ((r * F48S32) + (r * F48C32)))
+ n.noise(x + ((r * F48C33) - (r * F48S33)), z + ((r * F48S33) + (r * F48C33)))
+ n.noise(x + ((r * F48C34) - (r * F48S34)), z + ((r * F48S34) + (r * F48C34)))
+ n.noise(x + ((r * F48C35) - (r * F48S35)), z + ((r * F48S35) + (r * F48C35)))
+ n.noise(x + ((r * F48C36) - (r * F48S36)), z + ((r * F48S36) + (r * F48C36)))
+ n.noise(x + ((r * F48C37) - (r * F48S37)), z + ((r * F48S37) + (r * F48C37)))
+ n.noise(x + ((r * F48C38) - (r * F48S38)), z + ((r * F48S38) + (r * F48C38)))
+ n.noise(x + ((r * F48C39) - (r * F48S39)), z + ((r * F48S39) + (r * F48C39)))
+ n.noise(x + ((r * F48C40) - (r * F48S40)), z + ((r * F48S40) + (r * F48C40)))
+ n.noise(x + ((r * F48C41) - (r * F48S41)), z + ((r * F48S41) + (r * F48C41)))
+ n.noise(x + ((r * F48C42) - (r * F48S42)), z + ((r * F48S42) + (r * F48C42)))
+ n.noise(x + ((r * F48C43) - (r * F48S43)), z + ((r * F48S43) + (r * F48C43)))
+ n.noise(x + ((r * F48C44) - (r * F48S44)), z + ((r * F48S44) + (r * F48C44)))
+ n.noise(x + ((r * F48C45) - (r * F48S45)), z + ((r * F48S45) + (r * F48C45)))
+ n.noise(x + ((r * F48C46) - (r * F48S46)), z + ((r * F48S46) + (r * F48C46)))
+ n.noise(x + ((r * F48C47) - (r * F48S47)), z + ((r * F48S47) + (r * F48C47)))
+ n.noise(x + ((r * F48C48) - (r * F48S48)), z + ((r * F48S48) + (r * F48C48)))
+ n.noise(x + ((r * F48C49) - (r * F48S49)), z + ((r * F48S49) + (r * F48C49)))
+ n.noise(x + ((r * F48C50) - (r * F48S50)), z + ((r * F48S50) + (r * F48C50)))
+ n.noise(x + ((r * F48C51) - (r * F48S51)), z + ((r * F48S51) + (r * F48C51)))) / 48.0D;
}
private static double sc64(int x, int z, double r, NoiseProvider n) {
return (n.noise(x + ((r * F64C0) - (r * F64S0)), z + ((r * F64S0) + (r * F64C0)))
+ n.noise(x + ((r * F64C1) - (r * F64S1)), z + ((r * F64S1) + (r * F64C1)))

View File

@ -164,13 +164,10 @@ public class IO {
* Transfers the length of the buffer amount of data from the input stream to
* the output stream
*
* @param in
* the input
* @param out
* the output
* @param in the input
* @param out the output
* @return the actual transfered amount
* @throws IOException
* shit happens
* @throws IOException shit happens
*/
public static int transfer(InputStream in, OutputStream out, byte[] buffer) throws IOException {
int r = in.read(buffer);
@ -186,17 +183,12 @@ public class IO {
* Transfers the length of the buffer amount of data from the input stream to
* the output stream
*
* @param in
* the input
* @param out
* the output
* @param targetBuffer
* the buffer and size to use
* @param totalSize
* the total amount to transfer
* @param in the input
* @param out the output
* @param targetBuffer the buffer and size to use
* @param totalSize the total amount to transfer
* @return the actual transfered amount
* @throws IOException
* shit happens
* @throws IOException shit happens
*/
public static long transfer(InputStream in, OutputStream out, int targetBuffer, long totalSize) throws IOException {
long total = totalSize;
@ -241,15 +233,11 @@ public class IO {
* Fully move data from a finite inputstream to an output stream using a given
* buffer size. This does NOT close streams.
*
* @param in
* the input stream to read from
* @param out
* the output stream to writeNodeData to
* @param bufferSize
* the target buffer size
* @param in the input stream to read from
* @param out the output stream to writeNodeData to
* @param bufferSize the target buffer size
* @return total size transfered
* @throws IOException
* shit happens
* @throws IOException shit happens
*/
public static long fullTransfer(InputStream in, OutputStream out, int bufferSize) throws IOException {
long wrote = 0;
@ -267,8 +255,7 @@ public class IO {
/**
* Recursive delete (deleting folders)
*
* @param f
* the file to delete (and subfiles if folder)
* @param f the file to delete (and subfiles if folder)
*/
public static void delete(File f) {
if (f == null || !f.exists()) {
@ -419,10 +406,8 @@ public class IO {
* new file with size 0 or, if the file exists already, it is opened and closed
* without modifying it, but updating the file date and time.
*
* @param file
* the File to touch
* @throws IOException
* If an I/O problem occurs
* @param file the File to touch
* @throws IOException If an I/O problem occurs
*/
public static void touch(File file) throws IOException {
if (!file.exists()) {
@ -440,16 +425,11 @@ public class IO {
* does not exist. If the destination file exists, then this method will
* overwrite it.
*
* @param srcFile
* an existing file to copy, must not be null
* @param destFile
* the new file, must not be null
* @throws NullPointerException
* if source or destination is null
* @throws IOException
* if source or destination is invalid
* @throws IOException
* if an IO error occurs during copying
* @param srcFile an existing file to copy, must not be null
* @param destFile the new file, must not be null
* @throws NullPointerException if source or destination is null
* @throws IOException if source or destination is invalid
* @throws IOException if an IO error occurs during copying
*/
public static void copyFile(File srcFile, File destFile) throws IOException {
copyFile(srcFile, destFile, true);
@ -463,19 +443,13 @@ public class IO {
* does not exist. If the destination file exists, then this method will
* overwrite it.
*
* @param srcFile
* an existing file to copy, must not be null
* @param destFile
* the new file, must not be null
* @param preserveFileDate
* true if the file date of the copy should be the same as the
* @param srcFile an existing file to copy, must not be null
* @param destFile the new file, must not be null
* @param preserveFileDate true if the file date of the copy should be the same as the
* original
* @throws NullPointerException
* if source or destination is null
* @throws IOException
* if source or destination is invalid
* @throws IOException
* if an IO error occurs during copying
* @throws NullPointerException if source or destination is null
* @throws IOException if source or destination is invalid
* @throws IOException if an IO error occurs during copying
*/
public static void copyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (srcFile == null) {
@ -509,14 +483,10 @@ public class IO {
/**
* Internal copy file method.
*
* @param srcFile
* the validated source file, not null
* @param destFile
* the validated destination file, not null
* @param preserveFileDate
* whether to preserve the file date
* @throws IOException
* if an error occurs
* @param srcFile the validated source file, not null
* @param destFile the validated destination file, not null
* @param preserveFileDate whether to preserve the file date
* @throws IOException if an error occurs
*/
private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
@ -549,8 +519,7 @@ public class IO {
* Equivalent to {@link Reader#close()}, except any exceptions will be ignored.
* This is typically used in finally blocks.
*
* @param input
* the Reader to close, may be null or already closed
* @param input the Reader to close, may be null or already closed
*/
public static void closeQuietly(Reader input) {
try {
@ -569,8 +538,7 @@ public class IO {
* Equivalent to {@link Writer#close()}, except any exceptions will be ignored.
* This is typically used in finally blocks.
*
* @param output
* the Writer to close, may be null or already closed
* @param output the Writer to close, may be null or already closed
*/
public static void closeQuietly(Writer output) {
try {
@ -589,8 +557,7 @@ public class IO {
* Equivalent to {@link InputStream#close()}, except any exceptions will be
* ignored. This is typically used in finally blocks.
*
* @param input
* the InputStream to close, may be null or already closed
* @param input the InputStream to close, may be null or already closed
*/
public static void closeQuietly(InputStream input) {
try {
@ -612,8 +579,7 @@ public class IO {
* Equivalent to {@link OutputStream#close()}, except any exceptions will be
* ignored. This is typically used in finally blocks.
*
* @param output
* the OutputStream to close, may be null or already closed
* @param output the OutputStream to close, may be null or already closed
*/
public static void closeQuietly(OutputStream output) {
try {
@ -632,13 +598,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input
* the <code>InputStream</code> to read from
* @param input the <code>InputStream</code> to read from
* @return the requested byte array
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
*/
public static byte[] toByteArray(InputStream input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
@ -653,13 +616,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input
* the <code>Reader</code> to read from
* @param input the <code>Reader</code> to read from
* @return the requested byte array
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
*/
public static byte[] toByteArray(Reader input) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
@ -677,15 +637,11 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input
* the <code>Reader</code> to read from
* @param encoding
* the encoding to use, null means platform default
* @param input the <code>Reader</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested byte array
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static byte[] toByteArray(Reader input, String encoding) throws IOException {
@ -703,8 +659,7 @@ public class IO {
* <p>
* This is the same as {@link String#getBytes()}.
*
* @param input
* the <code>String</code> to convert
* @param input the <code>String</code> to convert
* @return the requested byte array
* @deprecated Use {@link String#getBytes()}
*/
@ -720,13 +675,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param is
* the <code>InputStream</code> to read from
* @param is the <code>InputStream</code> to read from
* @return the requested character array
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static char[] toCharArray(InputStream is) throws IOException {
@ -745,15 +697,11 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param is
* the <code>InputStream</code> to read from
* @param encoding
* the encoding to use, null means platform default
* @param is the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested character array
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static char[] toCharArray(InputStream is, String encoding) throws IOException {
@ -771,13 +719,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input
* the <code>Reader</code> to read from
* @param input the <code>Reader</code> to read from
* @return the requested character array
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static char[] toCharArray(Reader input) throws IOException {
@ -793,13 +738,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input
* the <code>InputStream</code> to read from
* @param input the <code>InputStream</code> to read from
* @return the requested String
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
*/
public static String toString(InputStream input) throws IOException {
StringWriter sw = new StringWriter();
@ -817,15 +759,11 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input
* the <code>InputStream</code> to read from
* @param encoding
* the encoding to use, null means platform default
* @param input the <code>InputStream</code> to read from
* @param encoding the encoding to use, null means platform default
* @return the requested String
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
*/
public static String toString(InputStream input, String encoding) throws IOException {
StringWriter sw = new StringWriter();
@ -839,13 +777,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input
* the <code>Reader</code> to read from
* @param input the <code>Reader</code> to read from
* @return the requested String
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
*/
public static String toString(Reader input) throws IOException {
StringWriter sw = new StringWriter();
@ -857,8 +792,7 @@ public class IO {
* Get the contents of a <code>byte[]</code> as a String using the default
* character encoding of the platform.
*
* @param input
* the byte array to read from
* @param input the byte array to read from
* @return the requested String
* @deprecated Use {@link String#String(byte[])}
*/
@ -877,15 +811,11 @@ public class IO {
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
*
* @param input
* the byte array to read from
* @param encoding
* the encoding to use, null means platform default
* @param input the byte array to read from
* @param encoding the encoding to use, null means platform default
* @return the requested String
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs (never occurs)
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs (never occurs)
* @deprecated Use {@link String#String(byte[], String)}
*/
@Deprecated
@ -904,13 +834,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input
* the <code>InputStream</code> to read from, not null
* @param input the <code>InputStream</code> to read from, not null
* @return the list of Strings, never null
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static List<String> readLines(InputStream input) throws IOException {
@ -928,15 +855,11 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input
* the <code>InputStream</code> to read from, not null
* @param encoding
* the encoding to use, null means platform default
* @param input the <code>InputStream</code> to read from, not null
* @param encoding the encoding to use, null means platform default
* @return the list of Strings, never null
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static List<String> readLines(InputStream input, String encoding) throws IOException {
@ -957,13 +880,10 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input
* the <code>Reader</code> to read from, not null
* @param input the <code>Reader</code> to read from, not null
* @return the list of Strings, never null
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static List<String> readLines(Reader input) throws IOException {
@ -981,8 +901,7 @@ public class IO {
* Convert the specified string to an input stream, encoded as bytes using the
* default character encoding of the platform.
*
* @param input
* the string to convert
* @param input the string to convert
* @return an input stream
* @since Commons IO 1.1
*/
@ -1001,13 +920,10 @@ public class IO {
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
*
* @param input
* the string to convert
* @param encoding
* the encoding to use, null means platform default
* @param input the string to convert
* @param encoding the encoding to use, null means platform default
* @return an input stream
* @throws IOException
* if the encoding is invalid
* @throws IOException if the encoding is invalid
* @since Commons IO 1.1
*/
public static InputStream toInputStream(String input, String encoding) throws IOException {
@ -1018,14 +934,10 @@ public class IO {
/**
* Writes bytes from a <code>byte[]</code> to an <code>OutputStream</code>.
*
* @param data
* the byte array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the byte array to writeNodeData, do not modify during output, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, OutputStream output) throws IOException {
@ -1040,14 +952,10 @@ public class IO {
* <p>
* This method uses {@link String#String(byte[])}.
*
* @param data
* the byte array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the byte array to writeNodeData, do not modify during output, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output) throws IOException {
@ -1068,16 +976,11 @@ public class IO {
* <p>
* This method uses {@link String#String(byte[], String)}.
*
* @param data
* the byte array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the byte array to writeNodeData, do not modify during output, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(byte[] data, Writer output, String encoding) throws IOException {
@ -1094,14 +997,10 @@ public class IO {
* Writes chars from a <code>char[]</code> to a <code>Writer</code> using the
* default character encoding of the platform.
*
* @param data
* the char array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the char array to writeNodeData, do not modify during output, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, Writer output) throws IOException {
@ -1116,14 +1015,10 @@ public class IO {
* <p>
* This method uses {@link String#String(char[])} and {@link String#getBytes()}.
*
* @param data
* the char array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the char array to writeNodeData, do not modify during output, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, OutputStream output) throws IOException {
@ -1145,16 +1040,11 @@ public class IO {
* This method uses {@link String#String(char[])} and
* {@link String#getBytes(String)}.
*
* @param data
* the char array to writeNodeData, do not modify during output, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the char array to writeNodeData, do not modify during output, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(char[] data, OutputStream output, String encoding) throws IOException {
@ -1170,14 +1060,10 @@ public class IO {
/**
* Writes chars from a <code>String</code> to a <code>Writer</code>.
*
* @param data
* the <code>String</code> to writeNodeData, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the <code>String</code> to writeNodeData, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, Writer output) throws IOException {
@ -1193,14 +1079,10 @@ public class IO {
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data
* the <code>String</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the <code>String</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output) throws IOException {
@ -1221,16 +1103,11 @@ public class IO {
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data
* the <code>String</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the <code>String</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(String data, OutputStream output, String encoding) throws IOException {
@ -1246,14 +1123,10 @@ public class IO {
/**
* Writes chars from a <code>StringBuffer</code> to a <code>Writer</code>.
*
* @param data
* the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(StringBuffer data, Writer output) throws IOException {
@ -1269,14 +1142,10 @@ public class IO {
* <p>
* This method uses {@link String#getBytes()}.
*
* @param data
* the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(StringBuffer data, OutputStream output) throws IOException {
@ -1297,16 +1166,11 @@ public class IO {
* <p>
* This method uses {@link String#getBytes(String)}.
*
* @param data
* the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if output is null
* @throws IOException
* if an I/O error occurs
* @param data the <code>StringBuffer</code> to writeNodeData, null ignored
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void write(StringBuffer data, OutputStream output, String encoding) throws IOException {
@ -1324,16 +1188,11 @@ public class IO {
* <code>OutputStream</code> line by line, using the default character encoding
* of the platform and the specified line ending.
*
* @param lines
* the lines to writeNodeData, null entries produce blank lines
* @param lineEnding
* the line separator to use, null is system default
* @param output
* the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @throws NullPointerException
* if the output is null
* @throws IOException
* if an I/O error occurs
* @param lines the lines to writeNodeData, null entries produce blank lines
* @param lineEnding the line separator to use, null is system default
* @param output the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @throws NullPointerException if the output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void writeLines(Collection<String> lines, String lineEnding, OutputStream output) throws IOException {
@ -1360,18 +1219,12 @@ public class IO {
* Character encoding names can be found at
* <a href="http://www.iana.org/assignments/character-sets">IANA</a>.
*
* @param lines
* the lines to writeNodeData, null entries produce blank lines
* @param lineEnding
* the line separator to use, null is system default
* @param output
* the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if the output is null
* @throws IOException
* if an I/O error occurs
* @param lines the lines to writeNodeData, null entries produce blank lines
* @param lineEnding the line separator to use, null is system default
* @param output the <code>OutputStream</code> to writeNodeData to, not null, not closed
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if the output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void writeLines(Collection<String> lines, String lineEnding, OutputStream output, String encoding) throws IOException {
@ -1401,16 +1254,11 @@ public class IO {
* Writes the <code>toString()</code> value of each item in a collection to a
* <code>Writer</code> line by line, using the specified line ending.
*
* @param lines
* the lines to writeNodeData, null entries produce blank lines
* @param lineEnding
* the line separator to use, null is system default
* @param writer
* the <code>Writer</code> to writeNodeData to, not null, not closed
* @throws NullPointerException
* if the input is null
* @throws IOException
* if an I/O error occurs
* @param lines the lines to writeNodeData, null entries produce blank lines
* @param lineEnding the line separator to use, null is system default
* @param writer the <code>Writer</code> to writeNodeData to, not null, not closed
* @throws NullPointerException if the input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void writeLines(Collection<String> lines, String lineEnding, Writer writer) throws IOException {
@ -1440,17 +1288,12 @@ public class IO {
* returned as an int. For large streams use the
* <code>copyLarge(InputStream, OutputStream)</code> method.
*
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @return the number of bytes copied
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @throws ArithmeticException
* if the byte count is too large
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @throws ArithmeticException if the byte count is too large
* @since Commons IO 1.1
*/
public static int copy(InputStream input, OutputStream output) throws IOException {
@ -1468,15 +1311,11 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedInputStream</code>.
*
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param input the <code>InputStream</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @return the number of bytes copied
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.3
*/
public static long copyLarge(InputStream input, OutputStream output) throws IOException {
@ -1499,14 +1338,10 @@ public class IO {
* <p>
* This method uses {@link InputStreamReader}.
*
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @param input the <code>InputStream</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(InputStream input, Writer output) throws IOException {
@ -1529,16 +1364,11 @@ public class IO {
* <p>
* This method uses {@link InputStreamReader}.
*
* @param input
* the <code>InputStream</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @param input the <code>InputStream</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(InputStream input, Writer output, String encoding) throws IOException {
@ -1561,17 +1391,12 @@ public class IO {
* returned as an int. For large streams use the
* <code>copyLarge(Reader, Writer)</code> method.
*
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @return the number of characters copied
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @throws ArithmeticException
* if the character count is too large
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @throws ArithmeticException if the character count is too large
* @since Commons IO 1.1
*/
public static int copy(Reader input, Writer output) throws IOException {
@ -1589,15 +1414,11 @@ public class IO {
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
*
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>Writer</code> to writeNodeData to
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to writeNodeData to
* @return the number of characters copied
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.3
*/
public static long copyLarge(Reader input, Writer output) throws IOException {
@ -1624,14 +1445,10 @@ public class IO {
* <p>
* This method uses {@link OutputStreamWriter}.
*
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @param input the <code>Reader</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(Reader input, OutputStream output) throws IOException {
@ -1660,16 +1477,11 @@ public class IO {
* <p>
* This method uses {@link OutputStreamWriter}.
*
* @param input
* the <code>Reader</code> to read from
* @param output
* the <code>OutputStream</code> to writeNodeData to
* @param encoding
* the encoding to use, null means platform default
* @throws NullPointerException
* if the input or output is null
* @throws IOException
* if an I/O error occurs
* @param input the <code>Reader</code> to read from
* @param output the <code>OutputStream</code> to writeNodeData to
* @param encoding the encoding to use, null means platform default
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static void copy(Reader input, OutputStream output, String encoding) throws IOException {
@ -1689,16 +1501,12 @@ public class IO {
* This method buffers the input internally using
* <code>BufferedInputStream</code> if they are not already buffered.
*
* @param input1
* the first stream
* @param input2
* the second stream
* @param input1 the first stream
* @param input2 the second stream
* @return true if the content of the streams are equal or they both don't
* exist, false otherwise
* @throws NullPointerException
* if either input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if either input is null
* @throws IOException if an I/O error occurs
*/
public static boolean contentEquals(InputStream input1, InputStream input2) throws IOException {
if (!(input1 instanceof BufferedInputStream)) {
@ -1727,16 +1535,12 @@ public class IO {
* This method buffers the input internally using <code>BufferedReader</code> if
* they are not already buffered.
*
* @param input1
* the first reader
* @param input2
* the second reader
* @param input1 the first reader
* @param input2 the second reader
* @return true if the content of the readers are equal or they both don't
* exist, false otherwise
* @throws NullPointerException
* if either input is null
* @throws IOException
* if an I/O error occurs
* @throws NullPointerException if either input is null
* @throws IOException if an I/O error occurs
* @since Commons IO 1.1
*/
public static boolean contentEquals(Reader input1, Reader input2) throws IOException {

Some files were not shown because too many files have changed in this diff Show More