From 4199824275eb89ef4b12ca3c607fae5da1a645a8 Mon Sep 17 00:00:00 2001 From: Daniel Mills Date: Mon, 6 Jan 2020 21:27:24 -0500 Subject: [PATCH] sdf --- src/main/java/ninja/bytecode/iris/Iris.java | 21 ++++++++- .../java/ninja/bytecode/iris/Settings.java | 4 +- .../java/ninja/bytecode/iris/WandManager.java | 2 +- .../iris/generator/biome/IrisBiome.java | 2 + .../bytecode/iris/schematic/Schematic.java | 43 +++---------------- .../ninja/bytecode/iris/util/WandUtil.java | 12 +++--- 6 files changed, 38 insertions(+), 46 deletions(-) diff --git a/src/main/java/ninja/bytecode/iris/Iris.java b/src/main/java/ninja/bytecode/iris/Iris.java index 1a59590f3..dbc7d3029 100644 --- a/src/main/java/ninja/bytecode/iris/Iris.java +++ b/src/main/java/ninja/bytecode/iris/Iris.java @@ -1,5 +1,6 @@ package ninja.bytecode.iris; +import java.io.File; import java.util.UUID; import java.util.function.Function; @@ -69,8 +70,6 @@ public class Iris extends JavaPlugin implements Listener } } - - Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> { for(World i : Bukkit.getWorlds()) { @@ -85,6 +84,24 @@ public class Iris extends JavaPlugin implements Listener } }, 0, 15); } + + public void convert(File folder) + { + if(!folder.exists()) + { + return; + } + + if(folder.isFile()) + { + + } + + for(File i : folder.listFiles()) + { + + } + } private int getTC() { diff --git a/src/main/java/ninja/bytecode/iris/Settings.java b/src/main/java/ninja/bytecode/iris/Settings.java index e6204fb22..ab192d3e6 100644 --- a/src/main/java/ninja/bytecode/iris/Settings.java +++ b/src/main/java/ninja/bytecode/iris/Settings.java @@ -12,7 +12,7 @@ public class Settings public PerformanceMode performanceMode = PerformanceMode.UNLIMITED; public int threadCount = 12; public int threadPriority = Thread.MAX_PRIORITY; - public boolean loadonstart = false; + public boolean loadonstart = true; } public static class GeneratorSettings @@ -26,7 +26,7 @@ public class Settings public double superHeightScale = 0.95; public double baseHeight = 0.165; public int seaLevel = 63; - public double caveDensity = 0; + public double caveDensity = 1; public double biomeScale = 2.46; public boolean flatBedrock = false; public boolean doSchematics = true; diff --git a/src/main/java/ninja/bytecode/iris/WandManager.java b/src/main/java/ninja/bytecode/iris/WandManager.java index 03cc01d20..5da76a45b 100644 --- a/src/main/java/ninja/bytecode/iris/WandManager.java +++ b/src/main/java/ninja/bytecode/iris/WandManager.java @@ -146,7 +146,7 @@ public class WandManager implements Listener if(e.getMessage().startsWith("/iload ")) { e.setCancelled(true); - Schematic s = new Schematic(1, 1, 1, 1, 1, 1); + Schematic s = new Schematic(1, 1, 1); File f = new File(Iris.instance.getDataFolder(), "schematics/" + e.getMessage().split("\\Q \\E")[1] + ".ish"); if(!f.exists()) { diff --git a/src/main/java/ninja/bytecode/iris/generator/biome/IrisBiome.java b/src/main/java/ninja/bytecode/iris/generator/biome/IrisBiome.java index 22706ad2f..e816c2a88 100644 --- a/src/main/java/ninja/bytecode/iris/generator/biome/IrisBiome.java +++ b/src/main/java/ninja/bytecode/iris/generator/biome/IrisBiome.java @@ -103,6 +103,7 @@ public class IrisBiome public static final IrisBiome SWAMP = new IrisBiome("Swamp", Biome.SWAMPLAND) .scatter(MB.of(Material.LONG_GRASS, 1), 0.04) .schematic("tree/willow", 2.5) + .schematic("tree/god/willow", 0.01) .schematic("boulder", 0.02) .scatter(MB.of(Material.LONG_GRASS, 2), 0.03); public static final IrisBiome PLAINS = new IrisBiome("Plains", Biome.PLAINS) @@ -151,6 +152,7 @@ public class IrisBiome .scatter(MB.of(Material.LONG_GRASS, 1), 0.13) .scatter(MB.of(Material.LONG_GRASS, 2), 0.13) .schematic("tree/willow", 1.21) + .schematic("tree/god/willow", 0.04) .schematic("tree/oak", 0.71) .schematic("boulder", 0.01) .schematic("boulder/smooth", 0.02) diff --git a/src/main/java/ninja/bytecode/iris/schematic/Schematic.java b/src/main/java/ninja/bytecode/iris/schematic/Schematic.java index 4695a0e54..a2e3e1303 100644 --- a/src/main/java/ninja/bytecode/iris/schematic/Schematic.java +++ b/src/main/java/ninja/bytecode/iris/schematic/Schematic.java @@ -26,19 +26,13 @@ public class Schematic private int w; private int h; private int d; - private int x; - private int y; - private int z; private final GMap s; - public Schematic(int w, int h, int d, int x, int y, int z) + public Schematic(int w, int h, int d) { this.w = w; this.h = h; this.d = d; - this.x = x; - this.y = y; - this.z = z; s = new GMap<>(); centeredHeight = false; } @@ -63,21 +57,6 @@ public class Schematic return d; } - public int getX() - { - return x; - } - - public int getY() - { - return y; - } - - public int getZ() - { - return z; - } - public GMap getSchematic() { return s; @@ -91,9 +70,9 @@ public class Schematic w = din.readInt(); h = din.readInt(); d = din.readInt(); - x = din.readInt(); - y = din.readInt(); - z = din.readInt(); + din.readInt(); + din.readInt(); + din.readInt(); int l = din.readInt(); clear(); @@ -113,9 +92,6 @@ public class Schematic dos.writeInt(w); dos.writeInt(h); dos.writeInt(d); - dos.writeInt(x); - dos.writeInt(y); - dos.writeInt(z); dos.writeInt(s.size()); for(BlockVector i : s.keySet()) @@ -130,11 +106,6 @@ public class Schematic dos.close(); } - public BlockVector getOffset() - { - return new BlockVector(x, y, z); - } - public MB get(int x, int y, int z) { return s.get(new BlockVector(x, y, z)); @@ -152,7 +123,7 @@ public class Schematic public Schematic copy() { - Schematic s = new Schematic(w, h, d, x, y, z); + Schematic s = new Schematic(w, h, d); s.fill(this.s); s.centeredHeight = centeredHeight; return s; @@ -171,7 +142,7 @@ public class Schematic public void place(World source, int wx, int wy, int wz) { - Location start = new Location(source, wx, wy, wz).clone().subtract(0, centeredHeight ? h / 2 : 0, 0); + Location start = new Location(source, wx, wy, wz).clone().add(w / 2, centeredHeight ? 0 : -(h / 2), d / 2); for(BlockVector i : getSchematic().k()) { @@ -197,7 +168,7 @@ public class Schematic public static Schematic load(File f) throws IOException { - Schematic s = new Schematic(1, 1, 1, 1, 1, 1); + Schematic s = new Schematic(1, 1, 1); FileInputStream fin = new FileInputStream(f); s.read(fin); diff --git a/src/main/java/ninja/bytecode/iris/util/WandUtil.java b/src/main/java/ninja/bytecode/iris/util/WandUtil.java index af3029914..f165acda6 100644 --- a/src/main/java/ninja/bytecode/iris/util/WandUtil.java +++ b/src/main/java/ninja/bytecode/iris/util/WandUtil.java @@ -12,7 +12,6 @@ import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.util.BlockVector; -import org.bukkit.util.Vector; import ninja.bytecode.iris.schematic.Schematic; import ninja.bytecode.shuriken.collections.GList; @@ -36,8 +35,7 @@ public class WandUtil { Location[] f = getCuboid(wand); Cuboid c = new Cuboid(f[0], f[1]); - Vector v = at.clone().subtract(c.getLowerNE()).toVector(); - Schematic s = new Schematic(c.getSizeX(), c.getSizeY(), c.getSizeZ(), v.getBlockX(), v.getBlockY(), v.getBlockZ()); + Schematic s = new Schematic(c.getSizeX(), c.getSizeY(), c.getSizeZ()); Iterator bb = c.iterator(); while(bb.hasNext()) { @@ -50,9 +48,13 @@ public class WandUtil byte data = b.getData(); - BlockVector bv = b.getLocation().toVector().toBlockVector().subtract(c.getLowerNE().toVector().toBlockVector()).toBlockVector(); + BlockVector bv = b.getLocation().subtract(c.getCenter()).toVector().toBlockVector(); System.out.println("Load " + bv + " " + b.getType()); - s.put(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ(), new MB(b.getType(), data)); + s.put(bv.getBlockX(), + bv.getBlockY(), + bv.getBlockZ(), + + new MB(b.getType(), data)); } return s;