This commit is contained in:
Daniel Mills 2020-01-06 21:27:24 -05:00
parent fc2abb0f3c
commit 4199824275
6 changed files with 38 additions and 46 deletions

View File

@ -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()
{

View File

@ -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;

View File

@ -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())
{

View File

@ -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)

View File

@ -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<BlockVector, MB> 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<BlockVector, MB> 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);

View File

@ -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<Block> 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;