mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
Schematics Support Priority, Rotated Blocks, Sink & NoRotate
This commit is contained in:
parent
f5ab7f3102
commit
8ced379e44
@ -15,7 +15,6 @@ import ninja.bytecode.iris.generator.IrisGenerator;
|
|||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
import ninja.bytecode.iris.util.BiomeLayer;
|
import ninja.bytecode.iris.util.BiomeLayer;
|
||||||
import ninja.bytecode.shuriken.format.F;
|
import ninja.bytecode.shuriken.format.F;
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
|
||||||
|
|
||||||
public class CommandIris implements CommandExecutor
|
public class CommandIris implements CommandExecutor
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mortar.util.text.C;
|
||||||
import ninja.bytecode.iris.controller.WandController;
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
import ninja.bytecode.iris.generator.genobject.GenObject;
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
import ninja.bytecode.iris.util.Cuboid;
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
@ -99,6 +100,9 @@ public class CommandIsh implements CommandExecutor
|
|||||||
s.read(fin, true);
|
s.read(fin, true);
|
||||||
|
|
||||||
boolean cursor = false;
|
boolean cursor = false;
|
||||||
|
Direction df = null;
|
||||||
|
Direction dt = null;
|
||||||
|
|
||||||
for(String i : args)
|
for(String i : args)
|
||||||
{
|
{
|
||||||
if(i.equalsIgnoreCase("cursor"))
|
if(i.equalsIgnoreCase("cursor"))
|
||||||
@ -106,6 +110,22 @@ public class CommandIsh implements CommandExecutor
|
|||||||
cursor = true;
|
cursor = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(i.startsWith("from:"))
|
||||||
|
{
|
||||||
|
df = Direction.valueOf(i.split("\\Q:\\E")[1].toUpperCase().substring(0, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i.startsWith("to:"))
|
||||||
|
{
|
||||||
|
dt = Direction.valueOf(i.split("\\Q:\\E")[1].toUpperCase().substring(0, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dt != null && df != null)
|
||||||
|
{
|
||||||
|
msg(sender, "Rotating " + C.WHITE + df + C.GRAY + " to " + C.WHITE + dt);
|
||||||
|
s.rotate(df, dt);
|
||||||
}
|
}
|
||||||
|
|
||||||
Location at = p.getLocation();
|
Location at = p.getLocation();
|
||||||
|
@ -7,10 +7,18 @@ import java.io.FileInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.material.Directional;
|
||||||
|
import org.bukkit.material.Ladder;
|
||||||
|
import org.bukkit.material.MaterialData;
|
||||||
|
import org.bukkit.material.Stairs;
|
||||||
|
import org.bukkit.material.Vine;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@ -231,7 +239,11 @@ public class GenObject
|
|||||||
|
|
||||||
public Location place(Location l)
|
public Location place(Location l)
|
||||||
{
|
{
|
||||||
return place(l, new NMSPlacer(l.getWorld()));
|
NMSPlacer p;
|
||||||
|
Location ll = place(l, p = new NMSPlacer(l.getWorld()));
|
||||||
|
p.flush();
|
||||||
|
|
||||||
|
return ll;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location place(Location l, IPlacer placer)
|
public Location place(Location l, IPlacer placer)
|
||||||
@ -263,12 +275,6 @@ public class GenObject
|
|||||||
for(SBlockVector i : s.keySet())
|
for(SBlockVector i : s.keySet())
|
||||||
{
|
{
|
||||||
MB b = getSchematic().get(i);
|
MB b = getSchematic().get(i);
|
||||||
|
|
||||||
if(b.material.equals(Material.CONCRETE_POWDER))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Location f = start.clone().add(i.toBlockVector());
|
Location f = start.clone().add(i.toBlockVector());
|
||||||
|
|
||||||
Material m = placer.get(f.clone().subtract(0, 1, 0)).material;
|
Material m = placer.get(f.clone().subtract(0, 1, 0)).material;
|
||||||
@ -343,13 +349,124 @@ public class GenObject
|
|||||||
|
|
||||||
for(SBlockVector i : g.keySet())
|
for(SBlockVector i : g.keySet())
|
||||||
{
|
{
|
||||||
MB mb = g.get(i);
|
MB mb = rotate(from, to, g.get(i));
|
||||||
s.put(new SBlockVector(VectorMath.rotate(from, to, i.toBlockVector()).toBlockVector()), mb);
|
s.put(new SBlockVector(VectorMath.rotate(from, to, i.toBlockVector()).toBlockVector()), mb);
|
||||||
}
|
}
|
||||||
|
|
||||||
name = name + "-rt" + to.name();
|
name = name + "-rt" + to.name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
private MB rotate(Direction from, Direction to, MB mb)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Material t = mb.material;
|
||||||
|
int i = t.getId();
|
||||||
|
byte d = mb.data;
|
||||||
|
MaterialData data = t.getData().getConstructor(int.class, byte.class).newInstance(i, d);
|
||||||
|
|
||||||
|
if(data instanceof Directional)
|
||||||
|
{
|
||||||
|
Directional dir = (Directional) data;
|
||||||
|
Supplier<BlockFace> get = dir::getFacing;
|
||||||
|
Consumer<BlockFace> set = dir::setFacingDirection;
|
||||||
|
|
||||||
|
if(dir instanceof Ladder)
|
||||||
|
{
|
||||||
|
get = ((Ladder) dir)::getAttachedFace;
|
||||||
|
set = ((Ladder) dir)::setFacingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dir instanceof Stairs)
|
||||||
|
{
|
||||||
|
get = ((Stairs) dir)::getAscendingDirection;
|
||||||
|
set = ((Stairs) dir)::setFacingDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
BlockFace fac = get.get();
|
||||||
|
set.accept(rotate(from, to, fac));
|
||||||
|
d = data.getData();
|
||||||
|
t = data.getItemType();
|
||||||
|
return MB.of(t, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(data instanceof Vine)
|
||||||
|
{
|
||||||
|
Vine vin = (Vine) data;
|
||||||
|
Vine vif = new Vine();
|
||||||
|
|
||||||
|
for(Direction j : Direction.news())
|
||||||
|
{
|
||||||
|
if(vin.isOnFace(j.getFace()))
|
||||||
|
{
|
||||||
|
vif.putOnFace(rotate(from, to, j.getFace()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
d = vif.getData();
|
||||||
|
t = vif.getItemType();
|
||||||
|
return MB.of(t, d);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(i >= 235 && i <= 250)
|
||||||
|
{
|
||||||
|
BlockFace fac = getGlazedTCDir(d);
|
||||||
|
d = toGlazedTCDir(Direction.getDirection(rotate(from, to, fac)).getFace());
|
||||||
|
t = data.getItemType();
|
||||||
|
return MB.of(t, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return mb;
|
||||||
|
}
|
||||||
|
|
||||||
|
private byte toGlazedTCDir(BlockFace b)
|
||||||
|
{
|
||||||
|
switch(b)
|
||||||
|
{
|
||||||
|
case NORTH:
|
||||||
|
return 0;
|
||||||
|
case EAST:
|
||||||
|
return 1;
|
||||||
|
case SOUTH:
|
||||||
|
return 2;
|
||||||
|
case WEST:
|
||||||
|
return 3;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BlockFace getGlazedTCDir(byte d2)
|
||||||
|
{
|
||||||
|
switch(d2)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
case 1:
|
||||||
|
return BlockFace.EAST;
|
||||||
|
case 2:
|
||||||
|
return BlockFace.SOUTH;
|
||||||
|
case 3:
|
||||||
|
return BlockFace.WEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
private BlockFace rotate(Direction from, Direction to, BlockFace face)
|
||||||
|
{
|
||||||
|
return Direction.getDirection(from.angle(Direction.getDirection(face).toVector(), to)).getFace();
|
||||||
|
}
|
||||||
|
|
||||||
public void computeFlag(String j)
|
public void computeFlag(String j)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -379,6 +496,12 @@ public class GenObject
|
|||||||
int downshift = Integer.valueOf(j.split("\\Q \\E")[1]);
|
int downshift = Integer.valueOf(j.split("\\Q \\E")[1]);
|
||||||
shift.subtract(new Vector(0, downshift, 0));
|
shift.subtract(new Vector(0, downshift, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(j.startsWith("raise "))
|
||||||
|
{
|
||||||
|
int downshift = Integer.valueOf(j.split("\\Q \\E")[1]);
|
||||||
|
shift.add(new Vector(0, downshift, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package ninja.bytecode.iris.generator.genobject;
|
package ninja.bytecode.iris.generator.genobject;
|
||||||
|
|
||||||
import java.lang.Thread.State;
|
import java.util.Collections;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.Executor;
|
import java.util.concurrent.Executor;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
@ -18,21 +18,21 @@ import mortar.logic.format.F;
|
|||||||
import mortar.util.text.C;
|
import mortar.util.text.C;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.TimingsController;
|
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
import ninja.bytecode.iris.generator.placer.BukkitPlacer;
|
import ninja.bytecode.iris.generator.placer.BukkitPlacer;
|
||||||
import ninja.bytecode.iris.generator.placer.NMSPlacer;
|
import ninja.bytecode.iris.generator.placer.NMSPlacer;
|
||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
import ninja.bytecode.iris.util.IPlacer;
|
import ninja.bytecode.iris.util.IPlacer;
|
||||||
|
import ninja.bytecode.shuriken.collections.GList;
|
||||||
import ninja.bytecode.shuriken.collections.GMap;
|
import ninja.bytecode.shuriken.collections.GMap;
|
||||||
import ninja.bytecode.shuriken.collections.GSet;
|
import ninja.bytecode.shuriken.collections.GSet;
|
||||||
import ninja.bytecode.shuriken.execution.ChronoLatch;
|
import ninja.bytecode.shuriken.execution.ChronoLatch;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
import ninja.bytecode.shuriken.math.M;
|
import ninja.bytecode.shuriken.math.M;
|
||||||
|
|
||||||
public class GenObjectDecorator extends BlockPopulator
|
public class GenObjectDecorator extends BlockPopulator
|
||||||
{
|
{
|
||||||
|
private GMap<IrisBiome, GList<GenObjectGroup>> orderCache;
|
||||||
private GMap<IrisBiome, GMap<GenObjectGroup, Double>> populationCache;
|
private GMap<IrisBiome, GMap<GenObjectGroup, Double>> populationCache;
|
||||||
private IPlacer placer;
|
private IPlacer placer;
|
||||||
private Executor ex;
|
private Executor ex;
|
||||||
@ -43,11 +43,13 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
{
|
{
|
||||||
this.g = generator;
|
this.g = generator;
|
||||||
populationCache = new GMap<>();
|
populationCache = new GMap<>();
|
||||||
|
orderCache = new GMap<>();
|
||||||
ex = Executors.newSingleThreadExecutor();
|
ex = Executors.newSingleThreadExecutor();
|
||||||
|
|
||||||
for(IrisBiome i : generator.getDimension().getBiomes())
|
for(IrisBiome i : generator.getDimension().getBiomes())
|
||||||
{
|
{
|
||||||
GMap<GenObjectGroup, Double> gc = new GMap<>();
|
GMap<GenObjectGroup, Double> gc = new GMap<>();
|
||||||
|
GMap<Integer, GList<GenObjectGroup>> or = new GMap<>();
|
||||||
int ff = 0;
|
int ff = 0;
|
||||||
for(String j : i.getSchematicGroups().k())
|
for(String j : i.getSchematicGroups().k())
|
||||||
{
|
{
|
||||||
@ -58,6 +60,13 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
GenObjectGroup g = generator.getDimension().getObjectGroup(j);
|
GenObjectGroup g = generator.getDimension().getObjectGroup(j);
|
||||||
ff += g.size();
|
ff += g.size();
|
||||||
gc.put(g, c);
|
gc.put(g, c);
|
||||||
|
|
||||||
|
if(!or.containsKey(g.getPiority()))
|
||||||
|
{
|
||||||
|
or.put(g.getPiority(), new GList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
or.get(g.getPiority()).add(g);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
@ -69,6 +78,14 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
|
|
||||||
if(!gc.isEmpty())
|
if(!gc.isEmpty())
|
||||||
{
|
{
|
||||||
|
GList<GenObjectGroup> g = new GList<>();
|
||||||
|
for(GList<GenObjectGroup> j : or.v())
|
||||||
|
{
|
||||||
|
g.addAll(j);
|
||||||
|
}
|
||||||
|
|
||||||
|
Collections.sort(g, (a, b) -> a.getPiority() - b.getPiority());
|
||||||
|
orderCache.put(i, g);
|
||||||
populationCache.put(i, gc);
|
populationCache.put(i, gc);
|
||||||
|
|
||||||
if(Iris.settings.performance.verbose)
|
if(Iris.settings.performance.verbose)
|
||||||
@ -89,7 +106,8 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ex.execute(() -> {
|
ex.execute(() ->
|
||||||
|
{
|
||||||
Random random = new Random(((source.getX() - 32) * (source.getZ() + 54)) + world.getSeed());
|
Random random = new Random(((source.getX() - 32) * (source.getZ() + 54)) + world.getSeed());
|
||||||
GSet<IrisBiome> hits = new GSet<>();
|
GSet<IrisBiome> hits = new GSet<>();
|
||||||
|
|
||||||
@ -113,7 +131,7 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
|
|
||||||
hits.add(biome);
|
hits.add(biome);
|
||||||
|
|
||||||
populate(world, random, source, biome, objects);
|
populate(world, random, source, biome, objects, orderCache.get(biome));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Iris.settings.performance.verbose)
|
if(Iris.settings.performance.verbose)
|
||||||
@ -123,9 +141,9 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populate(World world, Random random, Chunk source, IrisBiome biome, GMap<GenObjectGroup, Double> objects)
|
private void populate(World world, Random random, Chunk source, IrisBiome biome, GMap<GenObjectGroup, Double> objects, GList<GenObjectGroup> order)
|
||||||
{
|
{
|
||||||
for(GenObjectGroup i : objects.k())
|
for(GenObjectGroup i : order)
|
||||||
{
|
{
|
||||||
for(int j = 0; j < getTries(objects.get(i)); j++)
|
for(int j = 0; j < getTries(objects.get(i)); j++)
|
||||||
{
|
{
|
||||||
@ -138,6 +156,7 @@ public class GenObjectDecorator extends BlockPopulator
|
|||||||
|
|
||||||
if(!t.isSolid() || !biome.isSurface(t))
|
if(!t.isSolid() || !biome.isSurface(t))
|
||||||
{
|
{
|
||||||
|
L.w(C.WHITE + "Object " + C.YELLOW + i.getName() + "/*" + C.WHITE + " failed to place in " + C.YELLOW + t.toString().toLowerCase() + C.WHITE + " at " + C.YELLOW + F.f(b.getX()) + " " + F.f(b.getY()) + " " + F.f(b.getZ()));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,8 +11,6 @@ import ninja.bytecode.iris.Iris;
|
|||||||
import ninja.bytecode.iris.controller.PackController;
|
import ninja.bytecode.iris.controller.PackController;
|
||||||
import ninja.bytecode.iris.util.Direction;
|
import ninja.bytecode.iris.util.Direction;
|
||||||
import ninja.bytecode.shuriken.collections.GList;
|
import ninja.bytecode.shuriken.collections.GList;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
|
||||||
import ninja.bytecode.shuriken.format.F;
|
import ninja.bytecode.shuriken.format.F;
|
||||||
import ninja.bytecode.shuriken.io.IO;
|
import ninja.bytecode.shuriken.io.IO;
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
@ -22,12 +20,14 @@ public class GenObjectGroup
|
|||||||
private GList<GenObject> schematics;
|
private GList<GenObject> schematics;
|
||||||
private GList<String> flags;
|
private GList<String> flags;
|
||||||
private String name;
|
private String name;
|
||||||
|
private int priority;
|
||||||
|
|
||||||
public GenObjectGroup(String name)
|
public GenObjectGroup(String name)
|
||||||
{
|
{
|
||||||
this.schematics = new GList<>();
|
this.schematics = new GList<>();
|
||||||
this.flags = new GList<>();
|
this.flags = new GList<>();
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
priority = Integer.MIN_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void read(DataInputStream din) throws IOException
|
public void read(DataInputStream din) throws IOException
|
||||||
@ -148,6 +148,23 @@ public class GenObjectGroup
|
|||||||
return getSchematics().size();
|
return getSchematics().size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getPiority()
|
||||||
|
{
|
||||||
|
if(priority == Integer.MIN_VALUE)
|
||||||
|
{
|
||||||
|
for(String i : flags)
|
||||||
|
{
|
||||||
|
if(i.startsWith("priority "))
|
||||||
|
{
|
||||||
|
priority = Integer.valueOf(i.split("\\Q \\E")[1]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
public static GenObjectGroup load(String string)
|
public static GenObjectGroup load(String string)
|
||||||
{
|
{
|
||||||
File folder = Iris.getController(PackController.class).loadFolder(string);
|
File folder = Iris.getController(PackController.class).loadFolder(string);
|
||||||
@ -195,19 +212,6 @@ public class GenObjectGroup
|
|||||||
|
|
||||||
public void processVariants()
|
public void processVariants()
|
||||||
{
|
{
|
||||||
GList<GenObject> inject = new GList<>();
|
|
||||||
for(GenObject i : getSchematics())
|
|
||||||
{
|
|
||||||
for(Direction j : new Direction[] {Direction.S, Direction.E, Direction.W})
|
|
||||||
{
|
|
||||||
GenObject cp = i.copy();
|
|
||||||
GenObject f = cp;
|
|
||||||
f.rotate(Direction.N, j);
|
|
||||||
inject.add(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
getSchematics().add(inject);
|
|
||||||
for(GenObject i : getSchematics())
|
for(GenObject i : getSchematics())
|
||||||
{
|
{
|
||||||
i.recalculateMountShift();
|
i.recalculateMountShift();
|
||||||
@ -218,6 +222,24 @@ public class GenObjectGroup
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(!flags.contains("no rotation"))
|
||||||
|
{
|
||||||
|
GList<GenObject> inject = new GList<>();
|
||||||
|
for(GenObject i : getSchematics())
|
||||||
|
{
|
||||||
|
for(Direction j : new Direction[] {Direction.S, Direction.E, Direction.W})
|
||||||
|
{
|
||||||
|
GenObject cp = i.copy();
|
||||||
|
GenObject f = cp;
|
||||||
|
f.rotate(Direction.N, j);
|
||||||
|
f.recalculateMountShift();
|
||||||
|
inject.add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getSchematics().add(inject);
|
||||||
|
}
|
||||||
|
|
||||||
L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name);
|
L.i(ChatColor.LIGHT_PURPLE + "Processed " + ChatColor.WHITE + F.f(schematics.size()) + ChatColor.LIGHT_PURPLE + " Schematics in " + ChatColor.WHITE + name);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -231,4 +253,46 @@ public class GenObjectGroup
|
|||||||
schematics.clear();
|
schematics.clear();
|
||||||
flags.clear();
|
flags.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode()
|
||||||
|
{
|
||||||
|
final int prime = 31;
|
||||||
|
int result = 1;
|
||||||
|
result = prime * result + ((flags == null) ? 0 : flags.hashCode());
|
||||||
|
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||||
|
result = prime * result + priority;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj)
|
||||||
|
{
|
||||||
|
if(this == obj)
|
||||||
|
return true;
|
||||||
|
if(obj == null)
|
||||||
|
return false;
|
||||||
|
if(getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
GenObjectGroup other = (GenObjectGroup) obj;
|
||||||
|
if(flags == null)
|
||||||
|
{
|
||||||
|
if(other.flags != null)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(!flags.equals(other.flags))
|
||||||
|
return false;
|
||||||
|
if(name == null)
|
||||||
|
{
|
||||||
|
if(other.name != null)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else if(!name.equals(other.name))
|
||||||
|
return false;
|
||||||
|
if(priority != other.priority)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -8,8 +8,6 @@ import ninja.bytecode.iris.Iris;
|
|||||||
import ninja.bytecode.iris.controller.PackController;
|
import ninja.bytecode.iris.controller.PackController;
|
||||||
import ninja.bytecode.shuriken.collections.GList;
|
import ninja.bytecode.shuriken.collections.GList;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
import ninja.bytecode.shuriken.execution.J;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
|
||||||
import ninja.bytecode.shuriken.json.JSONArray;
|
import ninja.bytecode.shuriken.json.JSONArray;
|
||||||
import ninja.bytecode.shuriken.json.JSONException;
|
import ninja.bytecode.shuriken.json.JSONException;
|
||||||
import ninja.bytecode.shuriken.json.JSONObject;
|
import ninja.bytecode.shuriken.json.JSONObject;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package ninja.bytecode.iris.util;
|
package ninja.bytecode.iris.util;
|
||||||
|
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
||||||
@ -27,6 +28,53 @@ public enum Direction
|
|||||||
private int z;
|
private int z;
|
||||||
private CuboidDirection f;
|
private CuboidDirection f;
|
||||||
|
|
||||||
|
public static Direction getDirection(BlockFace f)
|
||||||
|
{
|
||||||
|
switch(f)
|
||||||
|
{
|
||||||
|
case DOWN:
|
||||||
|
return D;
|
||||||
|
case EAST:
|
||||||
|
return E;
|
||||||
|
case EAST_NORTH_EAST:
|
||||||
|
return E;
|
||||||
|
case EAST_SOUTH_EAST:
|
||||||
|
return E;
|
||||||
|
case NORTH:
|
||||||
|
return N;
|
||||||
|
case NORTH_EAST:
|
||||||
|
return N;
|
||||||
|
case NORTH_NORTH_EAST:
|
||||||
|
return N;
|
||||||
|
case NORTH_NORTH_WEST:
|
||||||
|
return N;
|
||||||
|
case NORTH_WEST:
|
||||||
|
return N;
|
||||||
|
case SELF:
|
||||||
|
return U;
|
||||||
|
case SOUTH:
|
||||||
|
return S;
|
||||||
|
case SOUTH_EAST:
|
||||||
|
return S;
|
||||||
|
case SOUTH_SOUTH_EAST:
|
||||||
|
return S;
|
||||||
|
case SOUTH_SOUTH_WEST:
|
||||||
|
return S;
|
||||||
|
case SOUTH_WEST:
|
||||||
|
return S;
|
||||||
|
case UP:
|
||||||
|
return U;
|
||||||
|
case WEST:
|
||||||
|
return W;
|
||||||
|
case WEST_NORTH_WEST:
|
||||||
|
return W;
|
||||||
|
case WEST_SOUTH_WEST:
|
||||||
|
return W;
|
||||||
|
}
|
||||||
|
|
||||||
|
return D;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
@ -441,6 +489,27 @@ public enum Direction
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BlockFace getFace()
|
||||||
|
{
|
||||||
|
switch(this)
|
||||||
|
{
|
||||||
|
case D:
|
||||||
|
return BlockFace.DOWN;
|
||||||
|
case E:
|
||||||
|
return BlockFace.EAST;
|
||||||
|
case N:
|
||||||
|
return BlockFace.NORTH;
|
||||||
|
case S:
|
||||||
|
return BlockFace.SOUTH;
|
||||||
|
case U:
|
||||||
|
return BlockFace.UP;
|
||||||
|
case W:
|
||||||
|
return BlockFace.WEST;
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public Axis getAxis()
|
public Axis getAxis()
|
||||||
{
|
{
|
||||||
switch(this)
|
switch(this)
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ninja.bytecode.iris.util;
|
package ninja.bytecode.iris.util;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import org.bukkit.configuration.serialization.SerializableAs;
|
import org.bukkit.configuration.serialization.SerializableAs;
|
||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user