diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml index bffb09868..b5f7a34af 100644 --- a/dependency-reduced-pom.xml +++ b/dependency-reduced-pom.xml @@ -174,7 +174,14 @@ cb - craftbukkit-1.12.2 + mort + 1 + system + ${project.basedir}/lib/Mortar.jar + + + cb + cb12 1 system ${project.basedir}/lib/craftbukkit-1.12.2.jar diff --git a/pom.xml b/pom.xml index a4d0d90cd..a453aa18a 100644 --- a/pom.xml +++ b/pom.xml @@ -160,7 +160,14 @@ provided - craftbukkit-1.12.2 + mort + cb + 1 + system + ${project.basedir}/lib/Mortar.jar + + + cb12 cb 1 system diff --git a/src/main/java/ninja/bytecode/iris/CommandIris.java b/src/main/java/ninja/bytecode/iris/CommandIris.java index af5f8abc1..788da8384 100644 --- a/src/main/java/ninja/bytecode/iris/CommandIris.java +++ b/src/main/java/ninja/bytecode/iris/CommandIris.java @@ -1,12 +1,14 @@ package ninja.bytecode.iris; import org.bukkit.ChatColor; +import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import mortar.api.nms.NMP; import ninja.bytecode.iris.controller.TimingsController; import ninja.bytecode.iris.generator.IrisGenerator; import ninja.bytecode.iris.pack.IrisBiome; @@ -108,6 +110,17 @@ public class CommandIris implements CommandExecutor msg(sender, "Reloading Iris..."); Iris.instance.reload(); } + + if(args[0].equalsIgnoreCase("refresh")) + { + msg(sender, "Sec..."); + Player p = ((Player) sender); + + for(Chunk i : p.getWorld().getLoadedChunks()) + { + NMP.CHUNK.refresh(p, i); + } + } } return false; diff --git a/src/main/java/ninja/bytecode/iris/Settings.java b/src/main/java/ninja/bytecode/iris/Settings.java index e11121e5c..b333fd850 100644 --- a/src/main/java/ninja/bytecode/iris/Settings.java +++ b/src/main/java/ninja/bytecode/iris/Settings.java @@ -1,7 +1,6 @@ package ninja.bytecode.iris; import ninja.bytecode.iris.util.PerformanceMode; -import ninja.bytecode.iris.util.PlacerType; public class Settings { @@ -11,20 +10,21 @@ public class Settings public static class PerformanceSettings { public PerformanceMode performanceMode = PerformanceMode.DOUBLE_CPU; - public PlacerType placerType = PlacerType.BUKKIT_NO_PHYSICS; + public boolean decoratePhysics = false; public int threadPriority = Thread.MIN_PRIORITY; public int compilerPriority = Thread.MIN_PRIORITY; public int threadCount = 1; public boolean debugMode = true; public int compilerThreads = 12; public int decorationAccuracy = 1; + public int cascadeLimit = 14; } public static class GeneratorSettings { public double horizontalZoom = 1; // 0.525 public double heightFracture = 155; - public double landScale = 0.205; + public double landScale = 0.325; public double landChance = 0.67; public double roughness = 1.333; public double heightMultiplier = 0.806; @@ -38,6 +38,6 @@ public class Settings public double caveScale = 1.45; public double biomeScale = 2; public boolean flatBedrock = false; - public boolean doSchematics = true; + public boolean genObjects = true; } } diff --git a/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java b/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java index d90e3c0a9..b5c032f19 100644 --- a/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java +++ b/src/main/java/ninja/bytecode/iris/generator/IrisGenerator.java @@ -133,6 +133,7 @@ public class IrisGenerator extends ParallelChunkGenerator @Override public Biome genColumn(int wxx, int wzx, int x, int z, ChunkPlan plan) { + int highest = 0; int seaLevel = Iris.settings.gen.seaLevel; double wx = Math.round((double) wxx * Iris.settings.gen.horizontalZoom); double wz = Math.round((double) wzx * Iris.settings.gen.horizontalZoom); @@ -144,7 +145,7 @@ public class IrisGenerator extends ParallelChunkGenerator int max = Math.max(height, seaLevel); IrisBiome override = null; - if(height > 61 && height < 65) + if(height > 61 && height < 65 + (glLNoise.getHeight(wz, wx) * 24D)) { override = biome("Beach"); } @@ -191,6 +192,7 @@ public class IrisGenerator extends ParallelChunkGenerator if(!mbx.material.equals(Material.AIR)) { setBlock(x, i + 1, z, mbx.material, mbx.data); + highest = i > highest ? i : highest; } } @@ -205,10 +207,11 @@ public class IrisGenerator extends ParallelChunkGenerator } setBlock(x, i, z, mb.material, mb.data); + highest = i > highest ? i : highest; } glCaves.genCaves(wxx, wzx, x, z, height, this); - + plan.setRealHeight(x, z, highest); return biome.getRealBiome(); } @@ -221,7 +224,7 @@ public class IrisGenerator extends ParallelChunkGenerator @Override public void onPostChunk(World world, int x, int z, Random random, AtomicChunkData data, ChunkPlan plan) { - + } @Override @@ -229,7 +232,7 @@ public class IrisGenerator extends ParallelChunkGenerator { GList p = new GList<>(); - if(Iris.settings.gen.doSchematics) + if(Iris.settings.gen.genObjects) { p.add(new GenObjectDecorator(this)); } diff --git a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObject.java b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObject.java index 2716a909f..f9d9b3a36 100644 --- a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObject.java +++ b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObject.java @@ -15,6 +15,7 @@ import org.bukkit.util.BlockVector; import org.bukkit.util.Vector; import ninja.bytecode.iris.Iris; +import ninja.bytecode.iris.generator.placer.NMSPlacer; import ninja.bytecode.iris.util.Direction; import ninja.bytecode.iris.util.IPlacer; import ninja.bytecode.iris.util.MB; @@ -35,12 +36,14 @@ public class GenObject private BlockVector mount; private int mountHeight; private BlockVector shift; + private boolean cascading; public GenObject(int w, int h, int d) { this.w = w; this.h = h; this.d = d; + cascading = false; shift = new BlockVector(); s = new GMap<>(); centeredHeight = false; @@ -121,6 +124,41 @@ public class GenObject { return s; } + + public int getWidth() + { + return w; + } + + public int getDepth() + { + return d; + } + + public int getAntiCascadeWidth() + { + if(isCascading()) + { + return -1; + } + + return 16 - w; + } + + public int getAntiCascadeDepth() + { + if(isCascading()) + { + return -1; + } + + return 16 - d; + } + + public boolean isCascading() + { + return cascading; + } @SuppressWarnings("deprecation") public void read(InputStream in) throws IOException @@ -130,6 +168,7 @@ public class GenObject w = din.readInt(); h = din.readInt(); d = din.readInt(); + cascading = w > Iris.settings.performance.cascadeLimit || d > Iris.settings.performance.cascadeLimit; int l = din.readInt(); clear(); @@ -203,12 +242,12 @@ public class GenObject int m = (g / 2); return g % 2 == 0 ? m : m + 1; } - + public void place(Location l) { - place(l, Iris.settings.performance.placerType.get(l.getWorld())); + place(l, new NMSPlacer(l.getWorld())); } - + public void place(Location l, IPlacer placer) { place(l.getBlockX(), l.getBlockY(), l.getBlockZ(), placer); diff --git a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java index d52c2293b..e3dd2b70c 100644 --- a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java +++ b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectDecorator.java @@ -15,10 +15,12 @@ import ninja.bytecode.iris.Iris; import ninja.bytecode.iris.controller.PackController; import ninja.bytecode.iris.controller.TimingsController; import ninja.bytecode.iris.generator.IrisGenerator; +import ninja.bytecode.iris.generator.placer.NMSPlacer; import ninja.bytecode.iris.pack.IrisBiome; import ninja.bytecode.iris.util.IPlacer; import ninja.bytecode.shuriken.collections.GMap; import ninja.bytecode.shuriken.collections.GSet; +import ninja.bytecode.shuriken.execution.ChronoLatch; import ninja.bytecode.shuriken.logging.L; import ninja.bytecode.shuriken.math.M; @@ -26,7 +28,9 @@ public class GenObjectDecorator extends BlockPopulator { private GMap biomeMap; private GMap> populationCache; + private IPlacer cascadingPlacer; private IPlacer placer; + private ChronoLatch cl = new ChronoLatch(1000); public GenObjectDecorator(IrisGenerator generator) { @@ -37,13 +41,14 @@ public class GenObjectDecorator extends BlockPopulator { biomeMap.put(i.getRealBiome(), i); - GMap gk = new GMap<>(); + GMap gc = new GMap<>(); for(String j : i.getSchematicGroups().k()) { try { - gk.put(Iris.getController(PackController.class).getGenObjectGroups().get(j), i.getSchematicGroups().get(j)); + GenObjectGroup g = Iris.getController(PackController.class).getGenObjectGroups().get(j); + gc.put(g, i.getSchematicGroups().get(j)); } catch(Throwable e) @@ -53,13 +58,17 @@ public class GenObjectDecorator extends BlockPopulator } } - populationCache.put(i.getRealBiome(), gk); + if(!gc.isEmpty()) + { + populationCache.put(i.getRealBiome(), gc); + } } } @Override - public void populate(World world, Random random, Chunk source) + public void populate(World world, Random rnotusingyou, Chunk source) { + Random random = new Random(((source.getX() - 32) * (source.getZ() + 54)) + world.getSeed()); Iris.getController(TimingsController.class).started("decor"); GSet hits = new GSet<>(); @@ -108,17 +117,22 @@ public class GenObjectDecorator extends BlockPopulator if(!t.isSolid() || !ibiome.isSurface(t)) { - return; + continue; } - if(placer == null) + if(cascadingPlacer == null) { - placer = Iris.settings.performance.placerType.get(world); + cascadingPlacer = new NMSPlacer(world); } - - i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(x, b.getY(), z, placer); + + i.getSchematics().get(random.nextInt(i.getSchematics().size())).place(x, b.getY(), z, cascadingPlacer); } } + + if(placer != null && cl.flip()) + { + placer.flush(); + } } public int getTries(double chance) diff --git a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectGroup.java b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectGroup.java index 106a318bf..32a105519 100644 --- a/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectGroup.java +++ b/src/main/java/ninja/bytecode/iris/generator/genobject/GenObjectGroup.java @@ -21,6 +21,7 @@ public class GenObjectGroup private GList flags; private String name; private int priority; + private boolean noCascade; public GenObjectGroup(String name) { @@ -28,6 +29,7 @@ public class GenObjectGroup this.flags = new GList<>(); priority = 0; this.name = name; + this.noCascade = false; } public String getName() @@ -85,7 +87,6 @@ public class GenObjectGroup for(File i : folder.listFiles()) { - if(i.getName().endsWith(".ifl")) { try @@ -162,7 +163,18 @@ public class GenObjectGroup gg.execute(); ex.close(); - L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name); + noCascade = true; + + for(GenObject i : getSchematics()) + { + if(i.isCascading()) + { + noCascade = false; + break; + } + } + + L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name + (noCascade ? ChatColor.AQUA + "*" : ChatColor.YELLOW + "^")); } @Override @@ -204,4 +216,9 @@ public class GenObjectGroup return false; return true; } + + public boolean isCascading() + { + return !noCascade; + } } diff --git a/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java b/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java index 134defaca..c8c3dde26 100644 --- a/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java +++ b/src/main/java/ninja/bytecode/iris/generator/layer/GenLayerBiome.java @@ -40,29 +40,29 @@ public class GenLayerBiome extends GenLayer pathCheck = new CNG(rng.nextParallelRNG(31), 1D, 1).scale(0.00096); roads = new MaxingGenerator(rng.nextParallelRNG(32), 5, 0.00055, 8, factory); //@done - + GMap regions = new GMap<>(); - + for(IrisBiome i : biomes) { if(!regions.containsKey(i.getRegion())) { regions.put(i.getRegion(), new IrisRegion(i.getRegion())); } - + regions.get(i.getRegion()).getBiomes().add(i); } int v = 85034; regionGenerator = new EnumMaxingGenerator(rng.nextParallelRNG(v), 0.00522 * Iris.settings.gen.biomeScale * 0.189, 1, regions.v().toArray(new IrisRegion[regions.v().size()]), factory); - + for(IrisRegion i : regions.v()) { v += 13 - i.getName().length(); - i.setGen(new EnumMaxingGenerator(rng.nextParallelRNG(33 + v), 0.000755 * i.getBiomes().size() * Iris.settings.gen.biomeScale, 1, i.getBiomes().toArray(new IrisBiome[i.getBiomes().size()]), factory)); + i.setGen(new EnumMaxingGenerator(rng.nextParallelRNG(33 + v), 0.000255 * i.getBiomes().size() * Iris.settings.gen.biomeScale, 1, i.getBiomes().toArray(new IrisBiome[i.getBiomes().size()]), factory)); } } - + public EnumMaxingGenerator getRegionGenerator(double xx, double zz) { return regionGenerator.getChoice(xx, zz).getGen(); diff --git a/src/main/java/ninja/bytecode/iris/generator/placer/AtomicPlacer.java b/src/main/java/ninja/bytecode/iris/generator/placer/AtomicPlacer.java new file mode 100644 index 000000000..871aa4964 --- /dev/null +++ b/src/main/java/ninja/bytecode/iris/generator/placer/AtomicPlacer.java @@ -0,0 +1,45 @@ +package ninja.bytecode.iris.generator.placer; + +import org.bukkit.Location; +import org.bukkit.World; + +import ninja.bytecode.iris.util.AtomicChunkData; +import ninja.bytecode.iris.util.ChunkPlan; +import ninja.bytecode.iris.util.MB; +import ninja.bytecode.iris.util.Placer; + +public class AtomicPlacer extends Placer +{ + private AtomicChunkData data; + private ChunkPlan plan; + + public AtomicPlacer(World world) + { + super(world); + } + + public void bind(AtomicChunkData data, ChunkPlan plan) + { + this.data = data; + this.plan = plan; + } + + @Override + public MB get(Location l) + { + return MB.of(data.getType(l.getBlockX(), l.getBlockY(), l.getBlockZ()), data.getData(l.getBlockX(), l.getBlockY(), l.getBlockZ())); + } + + @SuppressWarnings("deprecation") + @Override + public void set(Location l, MB mb) + { + data.setBlock(l.getBlockX(), l.getBlockY(), l.getBlockZ(), mb.material.getId(), mb.data); + } + + @Override + public int getHighestY(Location l) + { + return plan.getRealHeight(l.getBlockX(), l.getBlockZ()); + } +} diff --git a/src/main/java/ninja/bytecode/iris/util/BukkitPlacer.java b/src/main/java/ninja/bytecode/iris/generator/placer/BukkitPlacer.java similarity index 75% rename from src/main/java/ninja/bytecode/iris/util/BukkitPlacer.java rename to src/main/java/ninja/bytecode/iris/generator/placer/BukkitPlacer.java index d607f5402..78be29540 100644 --- a/src/main/java/ninja/bytecode/iris/util/BukkitPlacer.java +++ b/src/main/java/ninja/bytecode/iris/generator/placer/BukkitPlacer.java @@ -1,9 +1,12 @@ -package ninja.bytecode.iris.util; +package ninja.bytecode.iris.generator.placer; import org.bukkit.Location; import org.bukkit.World; import org.bukkit.block.Block; +import ninja.bytecode.iris.util.MB; +import ninja.bytecode.iris.util.Placer; + public class BukkitPlacer extends Placer { private final boolean applyPhysics; @@ -26,8 +29,7 @@ public class BukkitPlacer extends Placer @Override public void set(Location l, MB mb) { - Block b = world.getBlockAt(l); - b.setTypeIdAndData(mb.material.getId(), mb.data, applyPhysics); + l.getBlock().setTypeIdAndData(mb.material.getId(), mb.data, applyPhysics); } @Override diff --git a/src/main/java/ninja/bytecode/iris/generator/placer/NMSPlacer.java b/src/main/java/ninja/bytecode/iris/generator/placer/NMSPlacer.java new file mode 100644 index 000000000..5ef3ff0af --- /dev/null +++ b/src/main/java/ninja/bytecode/iris/generator/placer/NMSPlacer.java @@ -0,0 +1,60 @@ +package ninja.bytecode.iris.generator.placer; + +import org.bukkit.Chunk; +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.entity.Player; + +import mortar.api.nms.Catalyst; +import mortar.api.nms.NMP; +import mortar.api.world.MaterialBlock; +import ninja.bytecode.iris.util.MB; +import ninja.bytecode.iris.util.Placer; +import ninja.bytecode.shuriken.collections.GSet; + +public class NMSPlacer extends Placer +{ + private GSet c; + + public NMSPlacer(World world) + { + super(world); + c = new GSet<>(); + } + + @SuppressWarnings("deprecation") + @Override + public MB get(Location l) + { + Block b = world.getBlockAt(l); + return MB.of(b.getType(), b.getData()); + } + + @SuppressWarnings("deprecation") + @Override + public void set(Location l, MB mb) + { + Catalyst.host.setBlock(l, new MaterialBlock(mb.material.getId(), mb.data)); + c.add(l.getChunk()); + } + + @Override + public int getHighestY(Location l) + { + return world.getHighestBlockYAt(l); + } + + public void flush() + { + for(Chunk i : c) + { + for(Player j : NMP.CHUNK.nearbyPlayers(i)) + { + NMP.CHUNK.refresh(j, i); + } + } + + c.clear(); + } +} diff --git a/src/main/java/ninja/bytecode/iris/util/Catalyst12.java b/src/main/java/ninja/bytecode/iris/util/Catalyst12.java index eeb0bb6f8..7d3e3b49a 100644 --- a/src/main/java/ninja/bytecode/iris/util/Catalyst12.java +++ b/src/main/java/ninja/bytecode/iris/util/Catalyst12.java @@ -47,4 +47,6 @@ public class Catalyst12 net.minecraft.server.v1_12_R1.ChunkSection sec = chunk.getSections()[y >> 4]; sec.setType(x & 15, y & 15, z & 15, ibd); } + + } \ No newline at end of file diff --git a/src/main/java/ninja/bytecode/iris/util/ChronoQueue.java b/src/main/java/ninja/bytecode/iris/util/ChronoQueue.java new file mode 100644 index 000000000..b36f5c09b --- /dev/null +++ b/src/main/java/ninja/bytecode/iris/util/ChronoQueue.java @@ -0,0 +1,62 @@ +package ninja.bytecode.iris.util; + +import org.bukkit.Bukkit; + +import ninja.bytecode.iris.Iris; +import ninja.bytecode.shuriken.bench.PrecisionStopwatch; +import ninja.bytecode.shuriken.execution.ChronoLatch; +import ninja.bytecode.shuriken.execution.Queue; +import ninja.bytecode.shuriken.execution.ShurikenQueue; +import ninja.bytecode.shuriken.format.F; +import ninja.bytecode.shuriken.logging.L; + +public class ChronoQueue +{ + private PrecisionStopwatch s; + private Queue q; + private double limit; + private int jobLimit; + private ChronoLatch cl; + + public ChronoQueue(double limit, int jobLimit) + { + this.limit = limit; + this.jobLimit = jobLimit; + s = new PrecisionStopwatch(); + Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, this::tick, 0, 0); + q = new ShurikenQueue<>(); + cl = new ChronoLatch(1); + } + + public void queue(Runnable r) + { + q.queue(r); + } + + private void tick() + { + s.reset(); + s.begin(); + int m = 0; + while(q.hasNext() && (s.getMilliseconds() < limit || q.size() > jobLimit)) + { + m++; + try + { + q.next().run(); + } + + catch(Throwable e) + { + L.ex(e); + } + } + + if(cl.flip()) + { + System.out.println("Q: " + F.f(q.size()) + " T: " + F.duration(s.getMilliseconds(), 2) + " DID: " + F.f(m)); + } + + s.end(); + } +} diff --git a/src/main/java/ninja/bytecode/iris/util/ChunkPlan.java b/src/main/java/ninja/bytecode/iris/util/ChunkPlan.java index 398585004..417221708 100644 --- a/src/main/java/ninja/bytecode/iris/util/ChunkPlan.java +++ b/src/main/java/ninja/bytecode/iris/util/ChunkPlan.java @@ -2,40 +2,32 @@ package ninja.bytecode.iris.util; import java.util.function.Supplier; -import org.bukkit.util.BlockVector; - -import ninja.bytecode.iris.generator.genobject.GenObject; import ninja.bytecode.iris.pack.IrisBiome; import ninja.bytecode.shuriken.collections.GMap; public class ChunkPlan { + private final GMap realHeightCache; private final GMap heightCache; private final GMap biomeCache; - private final GMap schematics; - + public ChunkPlan() { - this.schematics = new GMap<>(); + this.realHeightCache = new GMap<>(); this.heightCache = new GMap<>(); this.biomeCache = new GMap<>(); } - - public void planSchematic(BlockVector b, GenObject s) - { - schematics.put(b, s); - } - + public IrisBiome getBiome(int x, int z) { return biomeCache.get(new ChunkedVector(x, z)); } - + public void setBiome(int x, int z, IrisBiome cng) { biomeCache.put(new ChunkedVector(x, z), cng); } - + public double getHeight(int x, int z, Supplier realHeight) { ChunkedVector c = new ChunkedVector(x, z); @@ -43,29 +35,50 @@ public class ChunkPlan { return heightCache.get(c); } - + double m = realHeight.get(); setHeight(c, m); return m; } - + + public int getRealHeight(int x, int z) + { + ChunkedVector c = new ChunkedVector(x, z); + if(realHeightCache.containsKey(c)) + { + return realHeightCache.get(c); + } + + return 0; + } + public boolean hasHeight(ChunkedVector c) { return heightCache.containsKey(c); } - + public boolean hasHeight(int x, int z) { return hasHeight(new ChunkedVector(x, z)); } - + public void setHeight(ChunkedVector c, double h) { heightCache.put(c, h); } - + + public void setRealHeight(ChunkedVector c, int h) + { + realHeightCache.put(c, h); + } + public void setHeight(int x, int z, double h) { setHeight(new ChunkedVector(x, z), h); } + + public void setRealHeight(int x, int z, int h) + { + setRealHeight(new ChunkedVector(x, z), h); + } } diff --git a/src/main/java/ninja/bytecode/iris/util/IPlacer.java b/src/main/java/ninja/bytecode/iris/util/IPlacer.java index 3344005e7..66ff5a3b4 100644 --- a/src/main/java/ninja/bytecode/iris/util/IPlacer.java +++ b/src/main/java/ninja/bytecode/iris/util/IPlacer.java @@ -12,4 +12,6 @@ public interface IPlacer public void set(Location l, MB mb); public int getHighestY(Location l); + + public void flush(); } diff --git a/src/main/java/ninja/bytecode/iris/util/NMSPlacer12.java b/src/main/java/ninja/bytecode/iris/util/NMSPlacer12.java deleted file mode 100644 index 16e2e68c2..000000000 --- a/src/main/java/ninja/bytecode/iris/util/NMSPlacer12.java +++ /dev/null @@ -1,73 +0,0 @@ -package ninja.bytecode.iris.util; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; - -import net.minecraft.server.v1_12_R1.Block; -import net.minecraft.server.v1_12_R1.Chunk; -import net.minecraft.server.v1_12_R1.ChunkSection; -import net.minecraft.server.v1_12_R1.IBlockData; -import net.minecraft.server.v1_12_R1.WorldServer; - -public class NMSPlacer12 extends Placer -{ - private CraftWorld craftWorld; - private WorldServer worldServer; - - public NMSPlacer12(World world) - { - super(world); - craftWorld = (CraftWorld) world; - worldServer = craftWorld.getHandle(); - } - - @SuppressWarnings("deprecation") - @Override - public MB get(Location l) - { - Chunk c = worldServer.getChunkAt(l.getBlockX() >> 4, l.getBlockZ() >> 4); - ChunkSection s = c.getSections()[l.getBlockY() >> 4]; - - if(s == null) - { - return MB.of(Material.AIR); - } - - IBlockData d = s.getType(l.getBlockX() & 15, l.getBlockY() & 15, l.getBlockZ() & 15); - Block block = d.getBlock(); - return MB.of(Material.getMaterial(Block.getId(block)), block.toLegacyData(d) << 12); - } - - @SuppressWarnings("deprecation") - @Override - public void set(Location l, MB mb) - { - Chunk c = worldServer.getChunkAt(l.getBlockX() >> 4, l.getBlockZ() >> 4); - int combined = mb.material.getId() + (mb.data << 12); - IBlockData ibd = net.minecraft.server.v1_12_R1.Block.getByCombinedId(combined); - - if(c.getSections()[l.getBlockY() >> 4] == null) - { - c.getSections()[l.getBlockY() >> 4] = new net.minecraft.server.v1_12_R1.ChunkSection(l.getBlockY() >> 4 << 4, c.world.worldProvider.m()); - } - - int h = c.b(l.getBlockX() & 15, l.getBlockZ() & 15); - if(l.getBlockY() > h) - { - c.heightMap[(l.getBlockZ() & 15) << 4 | (l.getBlockX() & 15)] = l.getBlockY(); - } - - net.minecraft.server.v1_12_R1.ChunkSection sec = c.getSections()[l.getBlockY() >> 4]; - sec.setType(l.getBlockX() & 15, l.getBlockY() & 15, l.getBlockZ() & 15, ibd); - c.markDirty(); - } - - @Override - public int getHighestY(Location l) - { - return worldServer.getChunkAt(l.getBlockX() >> 4, l.getBlockZ() >> 4) - .b(l.getBlockX() & 15, l.getBlockZ() & 15); - } -} diff --git a/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java b/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java index 2ab422e56..41884e11d 100644 --- a/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java +++ b/src/main/java/ninja/bytecode/iris/util/ParallelChunkGenerator.java @@ -14,7 +14,6 @@ import ninja.bytecode.shuriken.execution.ChronoLatch; import ninja.bytecode.shuriken.execution.TaskExecutor; import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup; import ninja.bytecode.shuriken.execution.TaskExecutor.TaskResult; -import ninja.bytecode.shuriken.logging.L; import ninja.bytecode.shuriken.math.RollingSequence; import ninja.bytecode.shuriken.reaction.O; @@ -41,7 +40,6 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator public void generateFullColumn(int a, int b, int c, int d, BiomeGrid g, ChunkPlan p) { g.setBiome(c, d, genColumn(a, b, c, d, p)); - decorateColumn(a, b, c, d, p); } public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) @@ -100,8 +98,6 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator data.setBlock(i, 0, j, Material.RED_GLAZED_TERRACOTTA); } } - - L.ex(e); } return data.toChunkData(); diff --git a/src/main/java/ninja/bytecode/iris/util/Placer.java b/src/main/java/ninja/bytecode/iris/util/Placer.java index 22565cf8a..d0450fb3e 100644 --- a/src/main/java/ninja/bytecode/iris/util/Placer.java +++ b/src/main/java/ninja/bytecode/iris/util/Placer.java @@ -16,4 +16,9 @@ public abstract class Placer implements IPlacer { return world; } + + public void flush() + { + + } } diff --git a/src/main/java/ninja/bytecode/iris/util/PlacerType.java b/src/main/java/ninja/bytecode/iris/util/PlacerType.java deleted file mode 100644 index a30fce8bf..000000000 --- a/src/main/java/ninja/bytecode/iris/util/PlacerType.java +++ /dev/null @@ -1,24 +0,0 @@ -package ninja.bytecode.iris.util; - -import java.util.function.Function; - -import org.bukkit.World; - -public enum PlacerType -{ - BUKKIT((w) -> new BukkitPlacer(w, true)), - BUKKIT_NO_PHYSICS((w) -> new BukkitPlacer(w, false)), - NMS((w) -> new NMSPlacer12(w)); - - private Function placer; - - private PlacerType(Function placer) - { - this.placer = placer; - } - - public IPlacer get(World world) - { - return placer.apply(world); - } -} diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 08edf6cb4..500e95030 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -3,4 +3,5 @@ version: ${project.version} main: ninja.bytecode.iris.Iris commands: iris: - ish: \ No newline at end of file + ish: +depend: [Mortar] \ No newline at end of file