mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-22 12:13:23 +00:00
Fixes
This commit is contained in:
parent
af22751210
commit
8a7bc3c17d
55
src/main/java/com/volmit/iris/command/CommandIrisTC.java
Normal file
55
src/main/java/com/volmit/iris/command/CommandIrisTC.java
Normal file
@ -0,0 +1,55 @@
|
||||
package com.volmit.iris.command;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.IrisChunkGenerator;
|
||||
import com.volmit.iris.util.MortarCommand;
|
||||
import com.volmit.iris.util.MortarSender;
|
||||
|
||||
public class CommandIrisTC extends MortarCommand
|
||||
{
|
||||
public CommandIrisTC()
|
||||
{
|
||||
super("ctc");
|
||||
setDescription("Change generator thread count");
|
||||
requiresPermission(Iris.perm.studio);
|
||||
setCategory("World");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(MortarSender sender, String[] args)
|
||||
{
|
||||
if(sender.isPlayer())
|
||||
{
|
||||
Player p = sender.player();
|
||||
World world = p.getWorld();
|
||||
|
||||
if(!(world.getGenerator() instanceof IrisChunkGenerator))
|
||||
{
|
||||
sender.sendMessage("You must be in an iris world.");
|
||||
return true;
|
||||
}
|
||||
|
||||
IrisChunkGenerator g = (IrisChunkGenerator) world.getGenerator();
|
||||
int m = Math.min(Math.max(Integer.valueOf(args[0]), 2), 256);
|
||||
g.changeThreadCount(m);
|
||||
sender.sendMessage("Thread count changed to " + m);
|
||||
return true;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
sender.sendMessage("Players only.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getArgsUsage()
|
||||
{
|
||||
return "[thread-count]";
|
||||
}
|
||||
}
|
@ -22,6 +22,9 @@ public class CommandIrisWorld extends MortarCommand
|
||||
@Command
|
||||
private CommandIrisHotload hotload;
|
||||
|
||||
@Command
|
||||
private CommandIrisTC tc;
|
||||
|
||||
public CommandIrisWorld()
|
||||
{
|
||||
super("world", "wrld", "w");
|
||||
|
@ -21,7 +21,6 @@ import com.volmit.iris.object.IrisRegion;
|
||||
import com.volmit.iris.util.BiomeResult;
|
||||
import com.volmit.iris.util.Form;
|
||||
import com.volmit.iris.util.Function2;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@ -33,7 +32,6 @@ import lombok.EqualsAndHashCode;
|
||||
public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisContext
|
||||
{
|
||||
private Method initLighting;
|
||||
private IrisLock lock;
|
||||
private IrisBiome hb = null;
|
||||
private IrisRegion hr = null;
|
||||
private KMap<Player, IrisBiome> b = new KMap<>();
|
||||
@ -41,19 +39,16 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
|
||||
public IrisChunkGenerator(String dimensionName, int threads)
|
||||
{
|
||||
super(dimensionName, threads);
|
||||
lock = new IrisLock("IrisChunkGenerator");
|
||||
}
|
||||
|
||||
public IrisChunkGenerator(String dimensionName)
|
||||
{
|
||||
super(dimensionName, 16);
|
||||
lock = new IrisLock("IrisChunkGenerator");
|
||||
}
|
||||
|
||||
public IrisChunkGenerator(int tc)
|
||||
{
|
||||
super("", tc);
|
||||
lock = new IrisLock("IrisChunkGenerator");
|
||||
}
|
||||
|
||||
public void hotload()
|
||||
@ -73,9 +68,7 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
|
||||
@Override
|
||||
protected void onGenerate(RNG random, int x, int z, ChunkData data, BiomeGrid grid)
|
||||
{
|
||||
lock.lock();
|
||||
super.onGenerate(random, x, z, data, grid);
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
public void onInit(World world, RNG rng)
|
||||
|
@ -697,7 +697,6 @@ public abstract class TerrainChunkGenerator extends ParallelChunkGenerator
|
||||
return i.getMax();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
|
@ -16,9 +16,6 @@ public class AtomicMulticache
|
||||
private final KMap<Long, BiomeResult> biome;
|
||||
private final KMap<Long, BiomeResult> rawBiome;
|
||||
private final KMap<Long, IrisRegion> region;
|
||||
private int r = 0;
|
||||
private int w = 0;
|
||||
private int m = 0;
|
||||
|
||||
public AtomicMulticache()
|
||||
{
|
||||
@ -34,9 +31,6 @@ public class AtomicMulticache
|
||||
{
|
||||
this.x.set(x);
|
||||
this.z.set(z);
|
||||
r = 0;
|
||||
w = 0;
|
||||
m = 0;
|
||||
|
||||
if(!IrisSettings.get().sharedCaching || getSize() > 42000)
|
||||
{
|
||||
@ -46,70 +40,58 @@ public class AtomicMulticache
|
||||
|
||||
public double getHeight(int x, int z, Supplier<Double> g)
|
||||
{
|
||||
return height.compute(pos(x, z), (k, v) ->
|
||||
Long pos = pos(x, z);
|
||||
Double r = height.get(pos);
|
||||
|
||||
if(r == null)
|
||||
{
|
||||
if(v == null)
|
||||
{
|
||||
m++;
|
||||
w++;
|
||||
return g.get();
|
||||
}
|
||||
r = g.get();
|
||||
height.put(pos, r);
|
||||
}
|
||||
|
||||
r++;
|
||||
|
||||
return v;
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
public IrisRegion getRegion(int x, int z, Supplier<IrisRegion> g)
|
||||
{
|
||||
return region.compute(pos(x, z), (k, v) ->
|
||||
Long pos = pos(x, z);
|
||||
IrisRegion r = region.get(pos);
|
||||
|
||||
if(r == null)
|
||||
{
|
||||
if(v == null)
|
||||
{
|
||||
m++;
|
||||
w++;
|
||||
return g.get();
|
||||
}
|
||||
r = g.get();
|
||||
region.put(pos, r);
|
||||
}
|
||||
|
||||
r++;
|
||||
|
||||
return v;
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
public BiomeResult getBiome(int x, int z, Supplier<BiomeResult> g)
|
||||
{
|
||||
return biome.compute(pos(x, z), (k, v) ->
|
||||
Long pos = pos(x, z);
|
||||
BiomeResult r = biome.get(pos);
|
||||
|
||||
if(r == null)
|
||||
{
|
||||
if(v == null)
|
||||
{
|
||||
m++;
|
||||
w++;
|
||||
return g.get();
|
||||
}
|
||||
r = g.get();
|
||||
biome.put(pos, r);
|
||||
}
|
||||
|
||||
r++;
|
||||
|
||||
return v;
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
public BiomeResult getRawBiome(int x, int z, Supplier<BiomeResult> g)
|
||||
{
|
||||
return rawBiome.compute(pos(x, z), (k, v) ->
|
||||
Long pos = pos(x, z);
|
||||
BiomeResult r = rawBiome.get(pos);
|
||||
|
||||
if(r == null)
|
||||
{
|
||||
if(v == null)
|
||||
{
|
||||
m++;
|
||||
w++;
|
||||
return g.get();
|
||||
}
|
||||
r = g.get();
|
||||
rawBiome.put(pos, r);
|
||||
}
|
||||
|
||||
r++;
|
||||
|
||||
return v;
|
||||
});
|
||||
return r;
|
||||
}
|
||||
|
||||
private long pos(int x, int z)
|
||||
|
@ -178,7 +178,7 @@ public class GenLayerCave extends GenLayer
|
||||
|
||||
public boolean canAir(Material m)
|
||||
{
|
||||
return (m.isSolid() || (B.isDecorant(m)) || m.equals(Material.AIR) || m.equals(B.mat("CAVE_AIR"))) && !m.equals(Material.BEDROCK);
|
||||
return (B.isSolid(m) || (B.isDecorant(m)) || m.equals(Material.AIR) || m.equals(B.mat("CAVE_AIR"))) && !m.equals(Material.BEDROCK);
|
||||
}
|
||||
|
||||
public boolean canWater(Material m)
|
||||
@ -188,7 +188,7 @@ public class GenLayerCave extends GenLayer
|
||||
|
||||
public boolean can(Material m)
|
||||
{
|
||||
return m.isSolid() && !m.equals(Material.BEDROCK);
|
||||
return B.isSolid(m) && !m.equals(Material.BEDROCK);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -12,13 +12,11 @@ public class GroupedExecutor
|
||||
{
|
||||
private int xc;
|
||||
private ExecutorService service;
|
||||
private IrisLock lock;
|
||||
private KMap<String, Integer> mirror;
|
||||
|
||||
public GroupedExecutor(int threadLimit, int priority, String name)
|
||||
{
|
||||
xc = 1;
|
||||
lock = new IrisLock("GX");
|
||||
mirror = new KMap<String, Integer>();
|
||||
|
||||
if(threadLimit == 1)
|
||||
@ -79,8 +77,6 @@ public class GroupedExecutor
|
||||
|
||||
while(true)
|
||||
{
|
||||
J.sleep(0);
|
||||
|
||||
if(mirror.get(g) == 0)
|
||||
{
|
||||
break;
|
||||
@ -97,13 +93,8 @@ public class GroupedExecutor
|
||||
|
||||
public void queue(String q, NastyRunnable r)
|
||||
{
|
||||
lock.lock();
|
||||
if(!mirror.containsKey(q))
|
||||
{
|
||||
mirror.put(q, 0);
|
||||
}
|
||||
mirror.put(q, mirror.get(q) + 1);
|
||||
lock.unlock();
|
||||
mirror.compute(q, (k, v) -> k == null || v == null ? 1 : v + 1);
|
||||
|
||||
service.execute(() ->
|
||||
{
|
||||
try
|
||||
@ -116,9 +107,7 @@ public class GroupedExecutor
|
||||
|
||||
}
|
||||
|
||||
lock.lock();
|
||||
mirror.put(q, mirror.get(q) - 1);
|
||||
lock.unlock();
|
||||
mirror.compute(q, (k, v) -> v - 1);
|
||||
});
|
||||
}
|
||||
|
||||
@ -126,7 +115,7 @@ public class GroupedExecutor
|
||||
{
|
||||
J.a(() ->
|
||||
{
|
||||
J.sleep(10000);
|
||||
J.sleep(100);
|
||||
service.shutdown();
|
||||
});
|
||||
}
|
||||
|
@ -132,6 +132,13 @@ public class IrisInterpolation
|
||||
return cubic(cubic(p00, p01, p02, p03, muy), cubic(p10, p11, p12, p13, muy), cubic(p20, p21, p22, p23, muy), cubic(p30, p31, p32, p33, muy), mux);
|
||||
}
|
||||
|
||||
public static double trilerp(double v1, double v2, double v3, double v4, double v5, double v6, double v7, double v8, double x, double y, double z)
|
||||
{
|
||||
double s = blerp(v1, v2, v3, v4, x, y);
|
||||
double t = blerp(v5, v6, v7, v8, x, y);
|
||||
return lerp(s, t, z);
|
||||
}
|
||||
|
||||
public static double getBilinearNoise(int x, int z, double rad, NoiseProvider n)
|
||||
{
|
||||
int fx = (int) Math.floor(x / rad);
|
||||
|
Loading…
x
Reference in New Issue
Block a user