mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-25 10:09:14 +00:00
WORKING
This commit is contained in:
@@ -58,7 +58,6 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
public RollingSequence hits = new RollingSequence(20);
|
||||
public RollingSequence tp = new RollingSequence(100);
|
||||
private static IrisLock lock = new IrisLock("Iris");
|
||||
public static KList<Class<? extends IrisPostBlockFilter>> postProcessors;
|
||||
|
||||
@Permission
|
||||
public static PermissionIris perm;
|
||||
@@ -97,7 +96,6 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
globaldata = new IrisDataManager(getDataFolder());
|
||||
wand = new WandManager();
|
||||
struct = new StructureManager();
|
||||
postProcessors = loadPostProcessors();
|
||||
proj = new ProjectManager();
|
||||
manager = new BoardManager(this, BoardSettings.builder().boardProvider(this).scoreDirection(ScoreDirection.UP).build());
|
||||
super.onEnable();
|
||||
@@ -192,7 +190,7 @@ public class Iris extends MortarPlugin implements BoardProvider
|
||||
return lines;
|
||||
}
|
||||
|
||||
private static KList<Class<? extends IrisPostBlockFilter>> loadPostProcessors()
|
||||
public static KList<Class<? extends IrisPostBlockFilter>> loadPostProcessors()
|
||||
{
|
||||
KList<Class<? extends IrisPostBlockFilter>> g = new KList<Class<? extends IrisPostBlockFilter>>();
|
||||
|
||||
|
||||
@@ -1416,7 +1416,7 @@ public class ProjectManager
|
||||
IO.writeAll(new File(of, "interpolation-method.txt"), m.toString("\n"));
|
||||
m = new KList<>();
|
||||
|
||||
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors)
|
||||
for(Class<? extends IrisPostBlockFilter> i : Iris.loadPostProcessors())
|
||||
{
|
||||
m.add(i.getDeclaredAnnotation(Post.class).value());
|
||||
}
|
||||
|
||||
@@ -153,7 +153,6 @@ public class IrisChunkGenerator extends PostBlockChunkGenerator implements IrisC
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
setAvailableFilters(null);
|
||||
setSliverCache(null);
|
||||
Iris.info("Closing Iris Dimension " + getWorld().getName());
|
||||
}
|
||||
|
||||
@@ -4,6 +4,12 @@ import org.bukkit.World;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.post.PostFloatingNibDeleter;
|
||||
import com.volmit.iris.gen.post.PostNibSmoother;
|
||||
import com.volmit.iris.gen.post.PostPotholeFiller;
|
||||
import com.volmit.iris.gen.post.PostSlabber;
|
||||
import com.volmit.iris.gen.post.PostWallPatcher;
|
||||
import com.volmit.iris.gen.post.PostWaterlogger;
|
||||
import com.volmit.iris.util.CaveResult;
|
||||
import com.volmit.iris.util.IPostBlockAccess;
|
||||
import com.volmit.iris.util.IrisLock;
|
||||
@@ -19,7 +25,6 @@ import lombok.EqualsAndHashCode;
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator implements IPostBlockAccess
|
||||
{
|
||||
private KList<IrisPostBlockFilter> availableFilters;
|
||||
private String postKey;
|
||||
private IrisLock lock;
|
||||
private int minPhase;
|
||||
@@ -28,7 +33,6 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
||||
public PostBlockChunkGenerator(String dimensionName, int threads)
|
||||
{
|
||||
super(dimensionName, threads);
|
||||
availableFilters = new KList<>();
|
||||
postKey = "post-" + dimensionName;
|
||||
lock = new IrisLock("PostChunkGenerator");
|
||||
}
|
||||
@@ -36,20 +40,6 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
||||
public void onInit(World world, RNG rng)
|
||||
{
|
||||
super.onInit(world, rng);
|
||||
|
||||
for(Class<? extends IrisPostBlockFilter> i : Iris.postProcessors)
|
||||
{
|
||||
try
|
||||
{
|
||||
availableFilters.add(i.getConstructor(PostBlockChunkGenerator.class).newInstance(this));
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
Iris.error("Failed to initialize post processor: " + i.getCanonicalName());
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -120,21 +110,34 @@ public abstract class PostBlockChunkGenerator extends ParallaxChunkGenerator imp
|
||||
|
||||
public IrisPostBlockFilter createProcessor(String processor, int phase)
|
||||
{
|
||||
for(IrisPostBlockFilter i : availableFilters)
|
||||
if(processor.equals("floating-block-remover"))
|
||||
{
|
||||
if(i.getKey().equals(processor))
|
||||
{
|
||||
try
|
||||
{
|
||||
return i.getClass().getConstructor(PostBlockChunkGenerator.class, int.class).newInstance(this, phase);
|
||||
}
|
||||
return new PostFloatingNibDeleter(this, phase);
|
||||
}
|
||||
|
||||
catch(Throwable e)
|
||||
{
|
||||
Iris.error("Failed initialize find post processor: " + processor);
|
||||
fail(e);
|
||||
}
|
||||
}
|
||||
if(processor.equals("nib-smoother"))
|
||||
{
|
||||
return new PostNibSmoother(this, phase);
|
||||
}
|
||||
|
||||
if(processor.equals("pothole-filler"))
|
||||
{
|
||||
return new PostPotholeFiller(this, phase);
|
||||
}
|
||||
|
||||
if(processor.equals("slabber"))
|
||||
{
|
||||
return new PostSlabber(this, phase);
|
||||
}
|
||||
|
||||
if(processor.equals("wall-painter"))
|
||||
{
|
||||
return new PostWallPatcher(this, phase);
|
||||
}
|
||||
|
||||
if(processor.equals("waterlogger"))
|
||||
{
|
||||
return new PostWaterlogger(this, phase);
|
||||
}
|
||||
|
||||
Iris.error("Failed to find post processor: " + processor);
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
|
||||
@Post("floating-block-remover")
|
||||
@@ -12,11 +13,13 @@ public class PostFloatingNibDeleter extends IrisPostBlockFilter
|
||||
{
|
||||
private static final BlockData AIR = B.getBlockData("AIR");
|
||||
|
||||
@DontObfuscate
|
||||
public PostFloatingNibDeleter(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
super(gen, phase);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public PostFloatingNibDeleter(PostBlockChunkGenerator gen)
|
||||
{
|
||||
this(gen, 0);
|
||||
|
||||
@@ -5,16 +5,19 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
|
||||
@Post("nib-smoother")
|
||||
public class PostNibSmoother extends IrisPostBlockFilter
|
||||
{
|
||||
@DontObfuscate
|
||||
public PostNibSmoother(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
super(gen, phase);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public PostNibSmoother(PostBlockChunkGenerator gen)
|
||||
{
|
||||
this(gen, 0);
|
||||
|
||||
@@ -3,16 +3,19 @@ package com.volmit.iris.gen.post;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
|
||||
@Post("pothole-filler")
|
||||
public class PostPotholeFiller extends IrisPostBlockFilter
|
||||
{
|
||||
@DontObfuscate
|
||||
public PostPotholeFiller(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
super(gen, phase);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public PostPotholeFiller(PostBlockChunkGenerator gen)
|
||||
{
|
||||
this(gen, 0);
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@@ -15,12 +16,14 @@ public class PostSlabber extends IrisPostBlockFilter
|
||||
public static final Material WATER = Material.WATER;
|
||||
private RNG rng;
|
||||
|
||||
@DontObfuscate
|
||||
public PostSlabber(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
super(gen, phase);
|
||||
rng = gen.getMasterRandom().nextParallelRNG(166456);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public PostSlabber(PostBlockChunkGenerator gen)
|
||||
{
|
||||
this(gen, 0);
|
||||
|
||||
@@ -6,6 +6,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.object.IrisBiome;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
import com.volmit.iris.util.RNG;
|
||||
|
||||
@@ -15,12 +16,14 @@ public class PostWallPatcher extends IrisPostBlockFilter
|
||||
public static final Material AIR = Material.AIR;
|
||||
private RNG rng;
|
||||
|
||||
@DontObfuscate
|
||||
public PostWallPatcher(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
super(gen, phase);
|
||||
rng = gen.getMasterRandom().nextParallelRNG(1239456);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public PostWallPatcher(PostBlockChunkGenerator gen)
|
||||
{
|
||||
this(gen, 0);
|
||||
|
||||
@@ -7,6 +7,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.gen.PostBlockChunkGenerator;
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.DontObfuscate;
|
||||
import com.volmit.iris.util.IrisPostBlockFilter;
|
||||
|
||||
@Post("waterlogger")
|
||||
@@ -14,11 +15,13 @@ public class PostWaterlogger extends IrisPostBlockFilter
|
||||
{
|
||||
private static final BlockData WATER = B.getBlockData("WATER");
|
||||
|
||||
@DontObfuscate
|
||||
public PostWaterlogger(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
super(gen, phase);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public PostWaterlogger(PostBlockChunkGenerator gen)
|
||||
{
|
||||
super(gen);
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({FIELD, TYPE})
|
||||
@Target({FIELD, TYPE, CONSTRUCTOR})
|
||||
public @interface DontObfuscate
|
||||
{
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess
|
||||
private String key;
|
||||
private KList<Runnable> queue = new KList<>();
|
||||
|
||||
@DontObfuscate
|
||||
public IrisPostBlockFilter(PostBlockChunkGenerator gen, int phase)
|
||||
{
|
||||
this.gen = gen;
|
||||
@@ -28,6 +29,7 @@ public abstract class IrisPostBlockFilter implements IPostBlockAccess
|
||||
key = getClass().getDeclaredAnnotation(Post.class).value();
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public IrisPostBlockFilter(PostBlockChunkGenerator gen)
|
||||
{
|
||||
this(gen, 0);
|
||||
|
||||
Reference in New Issue
Block a user