mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Faster Interpolatin
This commit is contained in:
parent
36d3849118
commit
672c39e58d
26
build.gradle
26
build.gradle
@ -33,7 +33,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group 'com.volmit.iris'
|
group 'com.volmit.iris'
|
||||||
version '1.5.18'
|
version '1.6'
|
||||||
def apiVersion = '1.17'
|
def apiVersion = '1.17'
|
||||||
def name = 'Iris'
|
def name = 'Iris'
|
||||||
def main = 'com.volmit.iris.Iris'
|
def main = 'com.volmit.iris.Iris'
|
||||||
@ -58,7 +58,6 @@ task copyDepends(type: Copy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
task release(type: proguard.gradle.ProGuardTask) {
|
task release(type: proguard.gradle.ProGuardTask) {
|
||||||
System.out.println("Java Mod: " + "${System.getProperty('java.home')}\\jmods\\java.base.jmod")
|
|
||||||
dependsOn(":copyDepends")
|
dependsOn(":copyDepends")
|
||||||
group('proguard')
|
group('proguard')
|
||||||
configuration 'proguard.pro'
|
configuration 'proguard.pro'
|
||||||
@ -115,27 +114,18 @@ shadowJar
|
|||||||
minimize()
|
minimize()
|
||||||
relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic'
|
relocate 'com.dfsek.paralithic', 'com.volmit.iris.util.paralithic'
|
||||||
relocate 'io.papermc.lib', 'com.volmit.iris.util.paper'
|
relocate 'io.papermc.lib', 'com.volmit.iris.util.paper'
|
||||||
relocate 'org.objectweb.asm', 'com.volmit.iris.util.asm'
|
|
||||||
relocate 'org.zeroturnaround.zip', 'com.volmit.iris.util.zlib'
|
|
||||||
relocate 'com.googlecode.concurrentlinkedhashmap', 'com.volmit.iris.util.collection'
|
|
||||||
dependencies {
|
dependencies {
|
||||||
include(dependency('org.zeroturnaround:zt-zip:1.14'))
|
|
||||||
include(dependency('com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'))
|
|
||||||
include(dependency('io.papermc:paperlib:1.0.5'))
|
include(dependency('io.papermc:paperlib:1.0.5'))
|
||||||
include(dependency('com.dfsek:Paralithic:0.4.0'))
|
include(dependency('com.dfsek:Paralithic:0.4.0'))
|
||||||
include(dependency('org.ow2.asm:asm:9.0'))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
manifest()
|
manifest()
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
// Provided or Classpath
|
||||||
compileOnly 'org.projectlombok:lombok:1.18.20'
|
compileOnly 'org.projectlombok:lombok:1.18.20'
|
||||||
annotationProcessor 'org.projectlombok:lombok:1.18.20'
|
annotationProcessor 'org.projectlombok:lombok:1.18.20'
|
||||||
implementation 'com.dfsek:Paralithic:0.4.0'
|
|
||||||
implementation 'org.zeroturnaround:zt-zip:1.14'
|
|
||||||
implementation 'io.papermc:paperlib:1.0.5'
|
|
||||||
implementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
|
|
||||||
implementation 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
|
implementation 'org.spigotmc:spigot-api:1.17-R0.1-SNAPSHOT'
|
||||||
implementation 'org.bukkit.craftbukkit:1.17:1.17'
|
implementation 'org.bukkit.craftbukkit:1.17:1.17'
|
||||||
implementation 'org.bukkit.craftbukkit:1.17.1:1.17.1'
|
implementation 'org.bukkit.craftbukkit:1.17.1:1.17.1'
|
||||||
@ -143,7 +133,17 @@ dependencies {
|
|||||||
implementation 'org.bukkit.craftbukkit:1.16.3:1.16.3'
|
implementation 'org.bukkit.craftbukkit:1.16.3:1.16.3'
|
||||||
implementation 'org.bukkit.craftbukkit:1.16.1:1.16.1'
|
implementation 'org.bukkit.craftbukkit:1.16.1:1.16.1'
|
||||||
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT'
|
implementation 'com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT'
|
||||||
implementation 'com.google.code.gson:gson:2.8.5'
|
|
||||||
implementation 'me.clip:placeholderapi:2.10.10'
|
implementation 'me.clip:placeholderapi:2.10.10'
|
||||||
|
|
||||||
|
// Shaded
|
||||||
|
implementation 'com.dfsek:Paralithic:0.4.0'
|
||||||
|
implementation 'io.papermc:paperlib:1.0.5'
|
||||||
|
|
||||||
|
// Dynamically Loaded
|
||||||
|
implementation 'it.unimi.dsi:fastutil:8.5.4'
|
||||||
|
implementation 'com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2'
|
||||||
|
implementation 'org.zeroturnaround:zt-zip:1.14'
|
||||||
|
implementation 'com.google.code.gson:gson:2.8.5'
|
||||||
implementation 'org.ow2.asm:asm:9.0'
|
implementation 'org.ow2.asm:asm:9.0'
|
||||||
|
implementation 'com.google.guava:guava:30.1.1-jre'
|
||||||
}
|
}
|
@ -431,12 +431,14 @@ public class IrisComplex implements DataProvider {
|
|||||||
double h = 0;
|
double h = 0;
|
||||||
|
|
||||||
for (IrisGenerator gen : generators) {
|
for (IrisGenerator gen : generators) {
|
||||||
double hi = gen.getInterpolator().interpolate(x, z, (xx, zz) ->
|
h += gen.getInterpolator().interpolate(x, z, (xx, zz) ->
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
IrisBiome bx = baseBiomeStream.get(xx, zz);
|
IrisBiome bx = baseBiomeStream.get(xx, zz);
|
||||||
|
|
||||||
return bx.getGenLinkMax(gen.getLoadKey());
|
return M.lerp(bx.getGenLinkMin(gen.getLoadKey()),
|
||||||
|
bx.getGenLinkMax(gen.getLoadKey()),
|
||||||
|
gen.getHeight(x, z, seed + 239945));
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -445,23 +447,6 @@ public class IrisComplex implements DataProvider {
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
double lo = gen.getInterpolator().interpolate(x, z, (xx, zz) ->
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
IrisBiome bx = baseBiomeStream.get(xx, zz);
|
|
||||||
|
|
||||||
return bx.getGenLinkMin(gen.getLoadKey());
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Iris.reportError(e);
|
|
||||||
e.printStackTrace();
|
|
||||||
Iris.warn("Failed to sample lo biome at " + xx + " " + zz + " using the generator " + gen.getLoadKey());
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
h += M.lerp(lo, hi, gen.getHeight(x, z, seed + 239945));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
AtomicDouble noise = new AtomicDouble(h + fluidHeight + overlayStream.get(x, z));
|
||||||
|
@ -70,7 +70,7 @@ public class IrisWorldManager extends EngineAssignedWorldManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int maxGroups = 3;
|
int maxGroups = 3;
|
||||||
int biomeBaseCooldownSeconds = 15;
|
int biomeBaseCooldownSeconds = 0;
|
||||||
|
|
||||||
for (UUID i : spawnCooldowns.k()) {
|
for (UUID i : spawnCooldowns.k()) {
|
||||||
if (M.ms() - spawnCooldowns.get(i) > TimeUnit.SECONDS.toMillis(biomeBaseCooldownSeconds)) {
|
if (M.ms() - spawnCooldowns.get(i) > TimeUnit.SECONDS.toMillis(biomeBaseCooldownSeconds)) {
|
||||||
|
@ -48,6 +48,7 @@ import com.volmit.iris.util.plugin.VolmitSender;
|
|||||||
import com.volmit.iris.util.reflect.V;
|
import com.volmit.iris.util.reflect.V;
|
||||||
import com.volmit.iris.util.scheduling.ChronoLatch;
|
import com.volmit.iris.util.scheduling.ChronoLatch;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
import com.volmit.iris.util.scheduling.Looper;
|
||||||
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
import com.volmit.iris.util.scheduling.PrecisionStopwatch;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
@ -83,9 +84,12 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
private final ChronoLatch hotloadcd;
|
private final ChronoLatch hotloadcd;
|
||||||
@Getter
|
@Getter
|
||||||
private double generatedPerSecond = 0;
|
private double generatedPerSecond = 0;
|
||||||
private final int art;
|
|
||||||
private ReactiveFolder hotloader = null;
|
private ReactiveFolder hotloader = null;
|
||||||
private IrisWorld cworld = null;
|
private IrisWorld cworld = null;
|
||||||
|
private final Looper ticker;
|
||||||
|
private final Looper cleaner;
|
||||||
|
private int hotloaderMisses = 0;
|
||||||
|
private long lastHotloadTime = 100;
|
||||||
|
|
||||||
public EngineCompositeGenerator() {
|
public EngineCompositeGenerator() {
|
||||||
this(null, true);
|
this(null, true);
|
||||||
@ -93,12 +97,53 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
public EngineCompositeGenerator(String query, boolean production) {
|
public EngineCompositeGenerator(String query, boolean production) {
|
||||||
super();
|
super();
|
||||||
|
ticker = new Looper() {
|
||||||
|
@Override
|
||||||
|
protected long loop() {
|
||||||
|
PrecisionStopwatch p = PrecisionStopwatch.start();
|
||||||
|
if(!tickHotloader())
|
||||||
|
{
|
||||||
|
hotloaderMisses++;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
hotloaderMisses = 0;
|
||||||
|
}
|
||||||
|
lastHotloadTime+= p.getMilliseconds();
|
||||||
|
lastHotloadTime /= 2;
|
||||||
|
|
||||||
|
return 120 + (long)(lastHotloadTime/2) + Math.min(hotloaderMisses * 125, 1375);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
ticker.setPriority(Thread.MIN_PRIORITY);
|
||||||
|
ticker.setName("Iris Project Manager");
|
||||||
|
|
||||||
|
cleaner = new Looper() {
|
||||||
|
@Override
|
||||||
|
protected long loop() {
|
||||||
|
if(getComposite() != null)
|
||||||
|
{
|
||||||
|
getComposite().clean();
|
||||||
|
}
|
||||||
|
|
||||||
|
return 10000;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
cleaner.setPriority(Thread.MIN_PRIORITY);
|
||||||
|
cleaner.setName("Iris Parallax Manager");
|
||||||
|
cleaner.start();
|
||||||
|
|
||||||
|
if(isStudio())
|
||||||
|
{
|
||||||
|
ticker.start();
|
||||||
|
}
|
||||||
|
|
||||||
hotloadcd = new ChronoLatch(3500);
|
hotloadcd = new ChronoLatch(3500);
|
||||||
mst = M.ms();
|
mst = M.ms();
|
||||||
this.production = production;
|
this.production = production;
|
||||||
this.dimensionQuery = query;
|
this.dimensionQuery = query;
|
||||||
initialized = new AtomicBoolean(false);
|
initialized = new AtomicBoolean(false);
|
||||||
art = J.ar(this::tick, 40);
|
|
||||||
populators = new KList<BlockPopulator>().qadd(new BlockPopulator() {
|
populators = new KList<BlockPopulator>().qadd(new BlockPopulator() {
|
||||||
@Override
|
@Override
|
||||||
public void populate(World world, Random random, Chunk chunk) {
|
public void populate(World world, Random random, Chunk chunk) {
|
||||||
@ -137,35 +182,24 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void tick() {
|
public boolean tickHotloader() {
|
||||||
if (getComposite() == null || isClosed()) {
|
if (getComposite() == null || isClosed()) {
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!initialized.get()) {
|
if (!initialized.get()) {
|
||||||
return;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
int pri = Thread.currentThread().getPriority();
|
|
||||||
Thread.currentThread().setPriority(Thread.MIN_PRIORITY);
|
|
||||||
|
|
||||||
if (M.ms() - mst > 1000) {
|
|
||||||
generatedPerSecond = (double) (generated - lgenerated) / ((double) (M.ms() - mst) / 1000D);
|
|
||||||
mst = M.ms();
|
|
||||||
lgenerated = generated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (hotloader != null) {
|
if (hotloader != null) {
|
||||||
hotloader.check();
|
return hotloader.check();
|
||||||
getComposite().clean();
|
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread.currentThread().setPriority(pri);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private synchronized IrisDimension getDimension(IrisWorld world) {
|
private synchronized IrisDimension getDimension(IrisWorld world) {
|
||||||
@ -562,6 +596,8 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
public Runnable generateChunkRawData(IrisWorld world, int x, int z, TerrainChunk tc, boolean multicore) {
|
public Runnable generateChunkRawData(IrisWorld world, int x, int z, TerrainChunk tc, boolean multicore) {
|
||||||
initialize(world);
|
initialize(world);
|
||||||
|
tickMetrics();
|
||||||
|
|
||||||
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
|
Hunk<BlockData> blocks = Hunk.view((ChunkData) tc);
|
||||||
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
|
Hunk<Biome> biomes = Hunk.view((BiomeGrid) tc);
|
||||||
Hunk<BlockData> post = Hunk.newAtomicHunk(biomes.getWidth(), biomes.getHeight(), biomes.getDepth());
|
Hunk<BlockData> post = Hunk.newAtomicHunk(biomes.getWidth(), biomes.getHeight(), biomes.getDepth());
|
||||||
@ -570,6 +606,14 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
return () -> blocks.insertSoftly(0, 0, 0, post, (b) -> b == null || B.isAirOrFluid(b));
|
return () -> blocks.insertSoftly(0, 0, 0, post, (b) -> b == null || B.isAirOrFluid(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void tickMetrics() {
|
||||||
|
if (M.ms() - mst > 1000) {
|
||||||
|
generatedPerSecond = (double) (generated - lgenerated) / ((double) (M.ms() - mst) / 1000D);
|
||||||
|
mst = M.ms();
|
||||||
|
lgenerated = generated;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canSpawn(World world, int x, int z) {
|
public boolean canSpawn(World world, int x, int z) {
|
||||||
return super.canSpawn(world, x, z);
|
return super.canSpawn(world, x, z);
|
||||||
@ -689,7 +733,11 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void close() {
|
public void close() {
|
||||||
J.car(art);
|
if(isStudio())
|
||||||
|
{
|
||||||
|
ticker.interrupt();
|
||||||
|
}
|
||||||
|
|
||||||
if (getComposite() != null) {
|
if (getComposite() != null) {
|
||||||
getComposite().close();
|
getComposite().close();
|
||||||
|
|
||||||
|
@ -586,16 +586,19 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (IrisFeaturePotential j : p.getAddFeatures()) {
|
for (IrisFeaturePotential j : p.getAddFeatures()) {
|
||||||
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
if(j.hasZone(rng, xx >> 4, zz >> 4))
|
||||||
double a = Math.max(v.getW(), v.getD());
|
{
|
||||||
|
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
||||||
|
double a = Math.max(v.getW(), v.getD());
|
||||||
|
|
||||||
for (IrisFeaturePositional k : rw.getFeatures()) {
|
for (IrisFeaturePositional k : rw.getFeatures()) {
|
||||||
if (k.getX() == xx && k.getZ() == zz) {
|
if (k.getX() == xx && k.getZ() == zz) {
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rw.getFeatures().add(new IrisFeaturePositional(xx, zz, j.getZone()));
|
rw.getFeatures().add(new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -646,16 +649,19 @@ public interface EngineParallaxManager extends DataProvider, IObjectPlacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
for (IrisFeaturePotential j : objectPlacement.getAddFeatures()) {
|
||||||
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
if(j.hasZone(rng, xx >> 4, zz >> 4))
|
||||||
double a = Math.max(v.getW(), v.getD());
|
{
|
||||||
|
ParallaxChunkMeta rw = getParallaxAccess().getMetaRW(xx >> 4, zz >> 4);
|
||||||
|
double a = Math.max(v.getW(), v.getD());
|
||||||
|
|
||||||
for (IrisFeaturePositional k : rw.getFeatures()) {
|
for (IrisFeaturePositional k : rw.getFeatures()) {
|
||||||
if (k.getX() == xx && k.getZ() == zz) {
|
if (k.getX() == xx && k.getZ() == zz) {
|
||||||
continue placing;
|
continue placing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
rw.getFeatures().add(new IrisFeaturePositional(xx, zz, j.getZone()));
|
rw.getFeatures().add(new IrisFeaturePositional(xx, zz, j.getZone()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,7 @@ public class IrisEntitySpawn implements IRare {
|
|||||||
return e;
|
return e;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
Iris.reportError(e);
|
Iris.reportError(e);
|
||||||
|
e.printStackTrace();
|
||||||
Iris.error(" Failed to retrieve real entity @ " + at);
|
Iris.error(" Failed to retrieve real entity @ " + at);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ package com.volmit.iris.util.io;
|
|||||||
|
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
|
import com.volmit.iris.util.math.M;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -48,10 +49,6 @@ public class FolderWatcher extends FileWatcher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (watchers == null) {
|
|
||||||
System.out.print("wtf");
|
|
||||||
}
|
|
||||||
|
|
||||||
for (File i : watchers.k()) {
|
for (File i : watchers.k()) {
|
||||||
if (!i.exists()) {
|
if (!i.exists()) {
|
||||||
watchers.remove(i);
|
watchers.remove(i);
|
||||||
@ -71,13 +68,13 @@ public class FolderWatcher extends FileWatcher {
|
|||||||
KMap<File, FolderWatcher> w = watchers.copy();
|
KMap<File, FolderWatcher> w = watchers.copy();
|
||||||
readProperties();
|
readProperties();
|
||||||
|
|
||||||
for (File i : w.k()) {
|
for (File i : w.keySet()) {
|
||||||
if (!watchers.containsKey(i)) {
|
if (!watchers.containsKey(i)) {
|
||||||
deleted.add(i);
|
deleted.add(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (File i : watchers.k()) {
|
for (File i : watchers.keySet()) {
|
||||||
if (!w.containsKey(i)) {
|
if (!w.containsKey(i)) {
|
||||||
created.add(i);
|
created.add(i);
|
||||||
} else {
|
} else {
|
||||||
@ -98,6 +95,34 @@ public class FolderWatcher extends FileWatcher {
|
|||||||
return super.checkModified();
|
return super.checkModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean checkModifiedFast() {
|
||||||
|
if(watchers == null || watchers.isEmpty())
|
||||||
|
{
|
||||||
|
return checkModified();
|
||||||
|
}
|
||||||
|
|
||||||
|
changed.clear();
|
||||||
|
created.clear();
|
||||||
|
deleted.clear();
|
||||||
|
|
||||||
|
if (file.isDirectory()) {
|
||||||
|
for (File i : watchers.keySet()) {
|
||||||
|
FolderWatcher fw = watchers.get(i);
|
||||||
|
if (fw.checkModifiedFast()) {
|
||||||
|
changed.add(fw.file);
|
||||||
|
}
|
||||||
|
|
||||||
|
changed.addAll(fw.getChanged());
|
||||||
|
created.addAll(fw.getCreated());
|
||||||
|
deleted.addAll(fw.getDeleted());
|
||||||
|
}
|
||||||
|
|
||||||
|
return !changed.isEmpty() || !created.isEmpty() || !deleted.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.checkModified();
|
||||||
|
}
|
||||||
|
|
||||||
public KMap<File, FolderWatcher> getWatchers() {
|
public KMap<File, FolderWatcher> getWatchers() {
|
||||||
return watchers;
|
return watchers;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public class ReactiveFolder {
|
|||||||
private final File folder;
|
private final File folder;
|
||||||
private final Consumer3<KList<File>, KList<File>, KList<File>> hotload;
|
private final Consumer3<KList<File>, KList<File>, KList<File>> hotload;
|
||||||
private FolderWatcher fw;
|
private FolderWatcher fw;
|
||||||
|
private int checkCycle = 0;
|
||||||
|
|
||||||
public ReactiveFolder(File folder, Consumer3<KList<File>, KList<File>, KList<File>> hotload) {
|
public ReactiveFolder(File folder, Consumer3<KList<File>, KList<File>, KList<File>> hotload) {
|
||||||
this.folder = folder;
|
this.folder = folder;
|
||||||
@ -39,10 +40,11 @@ public class ReactiveFolder {
|
|||||||
fw = new FolderWatcher(folder);
|
fw = new FolderWatcher(folder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void check() {
|
public boolean check() {
|
||||||
|
checkCycle++;
|
||||||
boolean modified = false;
|
boolean modified = false;
|
||||||
|
|
||||||
if (fw.checkModified()) {
|
if (checkCycle % 3 == 0 ? fw.checkModified() : fw.checkModifiedFast()) {
|
||||||
for (File i : fw.getCreated()) {
|
for (File i : fw.getCreated()) {
|
||||||
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json")) {
|
if (i.getName().endsWith(".iob") || i.getName().endsWith(".json")) {
|
||||||
modified = true;
|
modified = true;
|
||||||
@ -73,6 +75,6 @@ public class ReactiveFolder {
|
|||||||
hotload.accept(fw.getCreated(), fw.getChanged(), fw.getDeleted());
|
hotload.accept(fw.getCreated(), fw.getChanged(), fw.getDeleted());
|
||||||
}
|
}
|
||||||
|
|
||||||
fw.checkModified();
|
return fw.checkModified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,13 @@ load: STARTUP
|
|||||||
authors: [ cyberpwn, NextdoorPsycho ]
|
authors: [ cyberpwn, NextdoorPsycho ]
|
||||||
website: volmit.com
|
website: volmit.com
|
||||||
description: More than a Dimenson!
|
description: More than a Dimenson!
|
||||||
|
libraries:
|
||||||
|
- org.zeroturnaround:zt-zip:1.14
|
||||||
|
- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-lru:1.4.2
|
||||||
|
- org.ow2.asm:asm:9.0
|
||||||
|
- com.google.code.gson:gson:2.8.5
|
||||||
|
- it.unimi.dsi:fastutil:8.5.4
|
||||||
|
- com.google.guava:guava:30.1.1-jre
|
||||||
commands:
|
commands:
|
||||||
iris:
|
iris:
|
||||||
aliases: [ ir, irs ]
|
aliases: [ ir, irs ]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user