mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Deployments
This commit is contained in:
parent
64674026a6
commit
ea458935f0
@ -1,358 +0,0 @@
|
|||||||
package ninja.bytecode.iris;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
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 mortar.api.sched.J;
|
|
||||||
import mortar.util.text.C;
|
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
|
||||||
import ninja.bytecode.iris.generator.WorldReactor;
|
|
||||||
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
|
||||||
import ninja.bytecode.iris.pack.CompiledDimension;
|
|
||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
|
||||||
import ninja.bytecode.iris.util.BiomeLayer;
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
|
||||||
import ninja.bytecode.shuriken.collections.KMap;
|
|
||||||
import ninja.bytecode.shuriken.execution.ChronoLatch;
|
|
||||||
import ninja.bytecode.shuriken.format.Form;
|
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
|
||||||
|
|
||||||
public class CommandIris implements CommandExecutor
|
|
||||||
{
|
|
||||||
public void msg(CommandSender s, String msg)
|
|
||||||
{
|
|
||||||
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
|
||||||
{
|
|
||||||
if(args.length == 0)
|
|
||||||
{
|
|
||||||
msg(sender, "/iris timings - Iris Timings");
|
|
||||||
msg(sender, "/iris rtp [biome] - RTP to a biome");
|
|
||||||
msg(sender, "/iris otp [schematic] - RTP to a specific schematic");
|
|
||||||
msg(sender, "/iris info - Chunk info");
|
|
||||||
msg(sender, "/iris hotload - Recompile pack & inject into worlds");
|
|
||||||
msg(sender, "/iris reload - Reload & Recompile");
|
|
||||||
msg(sender, "/iris clean - Clean Pack Install in Iris Folder");
|
|
||||||
msg(sender, "/ish - Iris Schematic Commands");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args.length > 0)
|
|
||||||
{
|
|
||||||
if(args[0].equalsIgnoreCase("timings"))
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
World w = p.getWorld();
|
|
||||||
|
|
||||||
if(w.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
((IrisGenerator) w.getGenerator()).getMetrics().send(p, (m) -> msg(p, m));
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(p, "You must be in an iris world for this");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("info"))
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
World w = p.getWorld();
|
|
||||||
|
|
||||||
if(w.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
IrisGenerator g = (IrisGenerator) w.getGenerator();
|
|
||||||
IrisBiome biome = g.getBiome((int) g.getOffsetX(p.getLocation().getX(), p.getLocation().getZ()), (int) g.getOffsetZ(p.getLocation().getX(), p.getLocation().getZ()));
|
|
||||||
BiomeLayer l = new BiomeLayer(g, biome);
|
|
||||||
msg(p, "Biome: " + C.BOLD + C.WHITE + biome.getName() + C.RESET + C.GRAY + " (" + C.GOLD + l.getBiome().getRarityString() + C.GRAY + ")");
|
|
||||||
|
|
||||||
for(String i : biome.getSchematicGroups().k())
|
|
||||||
{
|
|
||||||
String f = "";
|
|
||||||
double percent = biome.getSchematicGroups().get(i);
|
|
||||||
|
|
||||||
if(percent > 1D)
|
|
||||||
{
|
|
||||||
f = (int) percent + " + " + Form.pc(percent - (int) percent, percent - (int) percent >= 0.01 ? 0 : 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
f = Form.pc(percent, percent >= 0.01 ? 0 : 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
msg(p, "* " + C.DARK_GREEN + i + ": " + C.BOLD + C.WHITE + f + C.RESET + C.GRAY + " (" + Form.f(g.getDimension().getObjectGroup(i).size()) + " variants)");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(sender, "Not in an Iris World");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("otp"))
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
World w = p.getWorld();
|
|
||||||
|
|
||||||
if(w.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
if(args.length >= 2)
|
|
||||||
{
|
|
||||||
PlacedObject o = ((IrisGenerator) w.getGenerator()).randomObject(args[1]);
|
|
||||||
|
|
||||||
if(o != null)
|
|
||||||
{
|
|
||||||
Location l = new Location(w, o.getX(), o.getY(), o.getZ());
|
|
||||||
p.teleport(l);
|
|
||||||
msg(p, "Found " + C.DARK_GREEN + o.getF().replace(":", "/" + C.WHITE));
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(p, "Found Nothing");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(p, "/iris otp <object/group>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("rtp"))
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
World w = p.getWorld();
|
|
||||||
|
|
||||||
if(w.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
if(args.length > 1)
|
|
||||||
{
|
|
||||||
IrisGenerator g = (IrisGenerator) w.getGenerator();
|
|
||||||
IrisBiome b = null;
|
|
||||||
for(IrisBiome i : g.getDimension().getBiomes())
|
|
||||||
{
|
|
||||||
if(args[1].toLowerCase().equals(i.getName().toLowerCase().replaceAll("\\Q \\E", "_")))
|
|
||||||
{
|
|
||||||
b = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(b == null)
|
|
||||||
{
|
|
||||||
msg(sender, "Unknown Biome: " + args[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(sender, "Looking for " + b.getName() + "...");
|
|
||||||
boolean f = false;
|
|
||||||
int t = 0;
|
|
||||||
for(int i = 0; i < 10000; i++)
|
|
||||||
{
|
|
||||||
int x = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
int z = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
|
|
||||||
if(g.getBiome((int) g.getOffsetX(x, z), (int) g.getOffsetZ(x, z)).equals(b))
|
|
||||||
{
|
|
||||||
f = true;
|
|
||||||
|
|
||||||
if(w.getHighestBlockYAt(x, z) > 66)
|
|
||||||
{
|
|
||||||
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
t++;
|
|
||||||
|
|
||||||
if(t > 30)
|
|
||||||
{
|
|
||||||
msg(sender, "Checked 30 " + b.getName() + " bearing chunks. All of them were underwater. Try Again!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!f)
|
|
||||||
{
|
|
||||||
msg(sender, "Looked for " + b.getName() + " in 10,000 different locations and could not find it. Try again!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int x = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
int z = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(sender, "Not in an Iris World");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("hotload"))
|
|
||||||
{
|
|
||||||
msg(sender, "=== Hotloading Pack ===");
|
|
||||||
PackController c = Iris.getController(PackController.class);
|
|
||||||
KMap<String, String> f = new KMap<>();
|
|
||||||
|
|
||||||
for(World i : Bukkit.getWorlds())
|
|
||||||
{
|
|
||||||
if(i.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
String n = ((IrisGenerator) i.getGenerator()).getDimension().getName();
|
|
||||||
msg(sender, "Preparing " + n);
|
|
||||||
f.put(i.getName(), n);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(f.isEmpty())
|
|
||||||
{
|
|
||||||
msg(sender, "No Worlds to inject!");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
J.a(() ->
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Consumer<String> m = (msg) ->
|
|
||||||
{
|
|
||||||
J.s(() ->
|
|
||||||
{
|
|
||||||
String mm = msg;
|
|
||||||
|
|
||||||
if(msg.contains("|"))
|
|
||||||
{
|
|
||||||
KList<String> fx = new KList<>();
|
|
||||||
fx.add(msg.split("\\Q|\\E"));
|
|
||||||
fx.remove(0);
|
|
||||||
fx.remove(0);
|
|
||||||
mm = fx.toString("");
|
|
||||||
}
|
|
||||||
|
|
||||||
msg(sender, mm.replaceAll("\\Q \\E", ""));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
L.addLogConsumer(m);
|
|
||||||
c.compile();
|
|
||||||
L.logConsumers.remove(m);
|
|
||||||
|
|
||||||
J.s(() ->
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
ChronoLatch cl = new ChronoLatch(3000);
|
|
||||||
Player p = (Player) sender;
|
|
||||||
World ww = ((Player) sender).getWorld();
|
|
||||||
|
|
||||||
msg(p, "Regenerating View Distance");
|
|
||||||
|
|
||||||
WorldReactor r = new WorldReactor(ww);
|
|
||||||
r.generateRegionNormal(p, true, 200, (pct) ->
|
|
||||||
{
|
|
||||||
if(cl.flip())
|
|
||||||
{
|
|
||||||
msg(p, "Regenerating " + Form.pc(pct));
|
|
||||||
}
|
|
||||||
}, () ->
|
|
||||||
{
|
|
||||||
msg(p, "Done! Use F3 + A");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 5);
|
|
||||||
|
|
||||||
for(String fi : f.k())
|
|
||||||
{
|
|
||||||
J.s(() ->
|
|
||||||
{
|
|
||||||
World i = Bukkit.getWorld(fi);
|
|
||||||
CompiledDimension dim = c.getDimension(f.get(fi));
|
|
||||||
|
|
||||||
for(String k : c.getDimensions().k())
|
|
||||||
{
|
|
||||||
if(c.getDimension(k).getName().equals(f.get(fi)))
|
|
||||||
{
|
|
||||||
dim = c.getDimension(k);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(dim == null)
|
|
||||||
{
|
|
||||||
J.s(() -> msg(sender, "Cannot find dimnension: " + f.get(fi)));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
msg(sender, "Hotloaded " + i.getName());
|
|
||||||
IrisGenerator g = ((IrisGenerator) i.getGenerator());
|
|
||||||
g.inject(dim);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("reload"))
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,280 +0,0 @@
|
|||||||
package ninja.bytecode.iris;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import mortar.util.text.C;
|
|
||||||
import ninja.bytecode.iris.controller.WandController;
|
|
||||||
import ninja.bytecode.iris.generator.genobject.GenObject;
|
|
||||||
import ninja.bytecode.iris.util.Cuboid;
|
|
||||||
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
|
||||||
import ninja.bytecode.iris.util.Direction;
|
|
||||||
import ninja.bytecode.shuriken.format.Form;
|
|
||||||
|
|
||||||
public class CommandIsh implements CommandExecutor
|
|
||||||
{
|
|
||||||
public void msg(CommandSender s, String msg)
|
|
||||||
{
|
|
||||||
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
|
||||||
{
|
|
||||||
if(args.length == 0)
|
|
||||||
{
|
|
||||||
msg(sender, "/ish wand - Get an Iris Wand");
|
|
||||||
msg(sender, "/ish save <name> - Save Schematic");
|
|
||||||
msg(sender, "/ish load <name> [cursor] - Paste Schematic");
|
|
||||||
msg(sender, "/ish expand <amount> - Expand Cuboid in direction");
|
|
||||||
msg(sender, "/ish shift <amount> - Shift Cuboid in direction");
|
|
||||||
msg(sender, "/ish shrinkwrap - Shrink to blocks");
|
|
||||||
msg(sender, "/ish xup - Shift up, Expand up, Contract in.");
|
|
||||||
msg(sender, "/ish xvert - Expand up, Expand down, Contract in.");
|
|
||||||
msg(sender, "/ish id - What id am i looking at");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args.length > 0)
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
if(args[0].equalsIgnoreCase("wand"))
|
|
||||||
{
|
|
||||||
p.getInventory().addItem(WandController.createWand());
|
|
||||||
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_DIAMOND, 1f, 1.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("id"))
|
|
||||||
{
|
|
||||||
|
|
||||||
Block b = p.getTargetBlock(null, 64);
|
|
||||||
msg(p, b.getType().getId() + ":" + b.getData() + " (" + b.getType().toString() + ":" + b.getData() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("save"))
|
|
||||||
{
|
|
||||||
GenObject s = WandController.createSchematic(p.getInventory().getItemInMainHand(), p.getLocation());
|
|
||||||
File f = new File(Iris.instance.getDataFolder(), "schematics/" + args[1] + ".ish");
|
|
||||||
f.getParentFile().mkdirs();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileOutputStream fos = new FileOutputStream(f);
|
|
||||||
s.write(fos, true);
|
|
||||||
msg(p, "Saved " + args[1] + " (" + Form.f(s.getSchematic().size()) + " Entries)");
|
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 0.45f);
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("load"))
|
|
||||||
{
|
|
||||||
GenObject s = new GenObject(1, 1, 1);
|
|
||||||
File f = new File(Iris.instance.getDataFolder(), "schematics/" + args[1] + ".ish");
|
|
||||||
if(!f.exists())
|
|
||||||
{
|
|
||||||
msg(p, "Not Found");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileInputStream fin = new FileInputStream(f);
|
|
||||||
s.read(fin, true);
|
|
||||||
|
|
||||||
boolean cursor = false;
|
|
||||||
Direction df = null;
|
|
||||||
Direction dt = null;
|
|
||||||
|
|
||||||
for(String i : args)
|
|
||||||
{
|
|
||||||
if(i.equalsIgnoreCase("cursor"))
|
|
||||||
{
|
|
||||||
cursor = true;
|
|
||||||
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();
|
|
||||||
|
|
||||||
if(cursor)
|
|
||||||
{
|
|
||||||
at = p.getTargetBlock(null, 64).getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
WandController.pasteSchematic(s, at);
|
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.25f);
|
|
||||||
msg(p, "Pasted " + args[1] + " (" + Form.f(s.getSchematic().size()) + " Blocks Modified)");
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("xup"))
|
|
||||||
{
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
b[0].add(new Vector(0, 1, 0));
|
|
||||||
b[1].add(new Vector(0, 1, 0));
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
|
|
||||||
while(!cursor.containsOnly(Material.AIR))
|
|
||||||
{
|
|
||||||
a1.add(new Vector(0, 1, 0));
|
|
||||||
a2.add(new Vector(0, 1, 0));
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1.add(new Vector(0, -1, 0));
|
|
||||||
a2.add(new Vector(0, -1, 0));
|
|
||||||
b[0] = a1;
|
|
||||||
a2 = b[1];
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("shrinkwrap") || args[0].equalsIgnoreCase("shrink"))
|
|
||||||
{
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
cursor = cursor.contract(CuboidDirection.Up);
|
|
||||||
cursor = cursor.contract(CuboidDirection.Down);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("expand"))
|
|
||||||
{
|
|
||||||
int amt = Integer.valueOf(args[1]);
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
cursor = cursor.expand(d, amt);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("shift"))
|
|
||||||
{
|
|
||||||
int amt = Integer.valueOf(args[1]);
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
a1.add(d.toVector().multiply(amt));
|
|
||||||
a2.add(d.toVector().multiply(amt));
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("xvert"))
|
|
||||||
{
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Location a1x = b[0].clone();
|
|
||||||
Location a2x = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Cuboid cursorx = new Cuboid(a1, a2);
|
|
||||||
|
|
||||||
while(!cursor.containsOnly(Material.AIR))
|
|
||||||
{
|
|
||||||
a1.add(new Vector(0, 1, 0));
|
|
||||||
a2.add(new Vector(0, 1, 0));
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1.add(new Vector(0, -1, 0));
|
|
||||||
a2.add(new Vector(0, -1, 0));
|
|
||||||
|
|
||||||
while(!cursorx.containsOnly(Material.AIR))
|
|
||||||
{
|
|
||||||
a1x.add(new Vector(0, -1, 0));
|
|
||||||
a2x.add(new Vector(0, -1, 0));
|
|
||||||
cursorx = new Cuboid(a1x, a2x);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1x.add(new Vector(0, 1, 0));
|
|
||||||
a2x.add(new Vector(0, 1, 0));
|
|
||||||
b[0] = a1;
|
|
||||||
b[1] = a2x;
|
|
||||||
cursor = new Cuboid(b[0], b[1]);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
65
src/main/java/ninja/bytecode/iris/CommandIshOld.java
Normal file
65
src/main/java/ninja/bytecode/iris/CommandIshOld.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
||||||
|
import ninja.bytecode.iris.util.Direction;
|
||||||
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
|
|
||||||
|
public class CommandIshOld implements CommandExecutor
|
||||||
|
{
|
||||||
|
public void msg(CommandSender s, String msg)
|
||||||
|
{
|
||||||
|
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
||||||
|
{
|
||||||
|
if(args.length == 0)
|
||||||
|
{
|
||||||
|
msg(sender, "/ish wand - Get an Iris Wand");
|
||||||
|
msg(sender, "/ish save <name> - Save Schematic");
|
||||||
|
msg(sender, "/ish load <name> [cursor] - Paste Schematic");
|
||||||
|
msg(sender, "/ish expand <amount> - Expand Cuboid in direction");
|
||||||
|
msg(sender, "/ish shift <amount> - Shift Cuboid in direction");
|
||||||
|
msg(sender, "/ish shrinkwrap - Shrink to blocks");
|
||||||
|
msg(sender, "/ish xup - Shift up, Expand up, Contract in.");
|
||||||
|
msg(sender, "/ish xvert - Expand up, Expand down, Contract in.");
|
||||||
|
msg(sender, "/ish id - What id am i looking at");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length > 0)
|
||||||
|
{
|
||||||
|
if(sender instanceof Player)
|
||||||
|
{
|
||||||
|
Player p = (Player) sender;
|
||||||
|
|
||||||
|
if(args[0].equalsIgnoreCase("xvert"))
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -1,82 +1,62 @@
|
|||||||
package ninja.bytecode.iris;
|
package ninja.bytecode.iris;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
|
import mortar.bukkit.command.Command;
|
||||||
|
import mortar.bukkit.plugin.Control;
|
||||||
|
import mortar.bukkit.plugin.Instance;
|
||||||
|
import mortar.bukkit.plugin.MortarPlugin;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.command.CommandIris;
|
||||||
|
import ninja.bytecode.iris.controller.ExecutionController;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
import ninja.bytecode.iris.controller.PackController;
|
||||||
import ninja.bytecode.iris.controller.WandController;
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
import ninja.bytecode.iris.util.Direction;
|
import ninja.bytecode.iris.util.Direction;
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.iris.util.IrisControllerSet;
|
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
|
|
||||||
public class Iris extends JavaPlugin implements Listener
|
public class Iris extends MortarPlugin
|
||||||
{
|
{
|
||||||
public IrisControllerSet controllerSet;
|
|
||||||
public static Thread primaryThread;
|
public static Thread primaryThread;
|
||||||
public static Settings settings;
|
public static Settings settings;
|
||||||
public static Iris instance;
|
|
||||||
public static IrisMetrics metrics;
|
public static IrisMetrics metrics;
|
||||||
|
|
||||||
public void onEnable()
|
@Instance
|
||||||
|
public static Iris instance;
|
||||||
|
|
||||||
|
@Control
|
||||||
|
private ExecutionController executionController;
|
||||||
|
|
||||||
|
@Control
|
||||||
|
private PackController packController;
|
||||||
|
|
||||||
|
@Control
|
||||||
|
private WandController wandController;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandIris commandIris;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start()
|
||||||
{
|
{
|
||||||
primaryThread = Thread.currentThread();
|
primaryThread = Thread.currentThread();
|
||||||
instance = this;
|
instance = this;
|
||||||
controllerSet = new IrisControllerSet();
|
|
||||||
L.consoleConsumer = (s) -> Bukkit.getConsoleSender().sendMessage(s);
|
L.consoleConsumer = (s) -> Bukkit.getConsoleSender().sendMessage(s);
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
controllerSet.startControllers(getFile());
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
L.ex(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
L.i("Controllers: " + controllerSet.size());
|
|
||||||
|
|
||||||
Direction.calculatePermutations();
|
Direction.calculatePermutations();
|
||||||
settings = new Settings();
|
settings = new Settings();
|
||||||
getServer().getPluginManager().registerEvents((Listener) this, this);
|
getServer().getPluginManager().registerEvents((Listener) this, this);
|
||||||
getCommand("iris").setExecutor(new CommandIris());
|
packController.compile();
|
||||||
getCommand("ish").setExecutor(new CommandIsh());
|
|
||||||
|
|
||||||
if(!settings.performance.debugMode)
|
|
||||||
{
|
|
||||||
getController(PackController.class).compile();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onDisable()
|
@Override
|
||||||
|
public void stop()
|
||||||
{
|
{
|
||||||
getController(PackController.class).dispose();
|
|
||||||
getController(WandController.class).dispose();
|
|
||||||
controllerSet.stopControllers();
|
|
||||||
HandlerList.unregisterAll((Plugin) this);
|
HandlerList.unregisterAll((Plugin) this);
|
||||||
Bukkit.getScheduler().cancelTasks(this);
|
Bukkit.getScheduler().cancelTasks(this);
|
||||||
|
|
||||||
if(Iris.settings.performance.debugMode)
|
|
||||||
{
|
|
||||||
for(World i : Bukkit.getWorlds())
|
|
||||||
{
|
|
||||||
if(i.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
((IrisGenerator) i.getGenerator()).dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
System.gc();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reload()
|
public void reload()
|
||||||
@ -88,15 +68,35 @@ public class Iris extends JavaPlugin implements Listener
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public static <T extends IrisController> T getController(Class<? extends T> c)
|
|
||||||
{
|
|
||||||
return (T) instance.controllerSet.get(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
|
public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
|
||||||
{
|
{
|
||||||
return new IrisGenerator();
|
return new IrisGenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTag(String arg0)
|
||||||
|
{
|
||||||
|
return makeTag(C.GREEN, C.DARK_GRAY, C.GRAY, C.BOLD + "Iris" + C.RESET);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String makeTag(C brace, C tag, C text, String tagName)
|
||||||
|
{
|
||||||
|
return brace + "\u3008" + tag + tagName + brace + "\u3009" + " " + text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PackController pack()
|
||||||
|
{
|
||||||
|
return instance.packController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ExecutionController exec()
|
||||||
|
{
|
||||||
|
return instance.executionController;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WandController wand()
|
||||||
|
{
|
||||||
|
return instance.wandController;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,10 @@ package ninja.bytecode.iris;
|
|||||||
|
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import mortar.compute.math.M;
|
import mortar.compute.math.M;
|
||||||
import mortar.util.text.C;
|
import mortar.util.text.C;
|
||||||
import ninja.bytecode.iris.controller.ExecutionController;
|
|
||||||
import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
|
import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.collections.KMap;
|
import ninja.bytecode.shuriken.collections.KMap;
|
||||||
@ -118,7 +117,7 @@ public class IrisMetrics
|
|||||||
this.sequences = sequences;
|
this.sequences = sequences;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send(Player p, Consumer<String> c)
|
public void send(CommandSender p, Consumer<String> c)
|
||||||
{
|
{
|
||||||
send(p, c, null, 0);
|
send(p, c, null, 0);
|
||||||
}
|
}
|
||||||
@ -128,7 +127,7 @@ public class IrisMetrics
|
|||||||
scale = sf;
|
scale = sf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void send(Player p, Consumer<String> c, String parent, int ind)
|
public void send(CommandSender p, Consumer<String> c, String parent, int ind)
|
||||||
{
|
{
|
||||||
KMap<String, String> out = new KMap<>();
|
KMap<String, String> out = new KMap<>();
|
||||||
|
|
||||||
@ -219,7 +218,7 @@ public class IrisMetrics
|
|||||||
if(ind == 0)
|
if(ind == 0)
|
||||||
{
|
{
|
||||||
c.accept(C.WHITE.toString() + C.BOLD + "Total Generators: " + C.RESET + C.DARK_AQUA + C.ITALIC + Form.f(generators));
|
c.accept(C.WHITE.toString() + C.BOLD + "Total Generators: " + C.RESET + C.DARK_AQUA + C.ITALIC + Form.f(generators));
|
||||||
c.accept(C.WHITE.toString() + C.BOLD + "Parallelism: " + C.RESET + C.DARK_PURPLE + C.ITALIC + Form.pc(scale) + C.WHITE + C.BOLD + " Threads: " + C.RESET + C.BLUE + C.ITALIC + Iris.getController(ExecutionController.class).getTC());
|
c.accept(C.WHITE.toString() + C.BOLD + "Parallelism: " + C.RESET + C.DARK_PURPLE + C.ITALIC + Form.pc(scale) + C.WHITE + C.BOLD + " Threads: " + C.RESET + C.BLUE + C.ITALIC + Iris.exec().getTC());
|
||||||
}
|
}
|
||||||
|
|
||||||
for(String i : out.k())
|
for(String i : out.k())
|
||||||
|
33
src/main/java/ninja/bytecode/iris/command/CommandFind.java
Normal file
33
src/main/java/ninja/bytecode/iris/command/CommandFind.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.Command;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
|
||||||
|
public class CommandFind extends MortarCommand
|
||||||
|
{
|
||||||
|
@Command
|
||||||
|
private CommandFindBiome fBiome;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandFindObject fObject;
|
||||||
|
|
||||||
|
public CommandFind()
|
||||||
|
{
|
||||||
|
super("find", "f");
|
||||||
|
setDescription("Teleport to a specific biome / object");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
for(MortarCommand i : getChildren())
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris find " + C.WHITE + i.getNode() + C.GRAY + (!i.getNodes().isEmpty() ? "," : "") + i.getNodes().toString(",") + " - " + C.DARK_GREEN + i.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,87 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
|
|
||||||
|
public class CommandFindBiome extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandFindBiome()
|
||||||
|
{
|
||||||
|
super("biome", "b");
|
||||||
|
setDescription("Teleport to a biome by name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
World w = null;
|
||||||
|
|
||||||
|
if(sender.isPlayer() && sender.player().getWorld().getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
w = sender.player().getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Console / Non-Iris World.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
IrisGenerator g = (IrisGenerator) w.getGenerator();
|
||||||
|
if(args.length > 0)
|
||||||
|
{
|
||||||
|
IrisBiome b = null;
|
||||||
|
for(IrisBiome i : g.getDimension().getBiomes())
|
||||||
|
{
|
||||||
|
if(args[0].toLowerCase().equals(i.getName().toLowerCase().replaceAll("\\Q \\E", "_")))
|
||||||
|
{
|
||||||
|
b = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(b == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Couldn't find any biomes containing '" + args[0] + "'.");
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Looking for Biome " + b.getName() + "...");
|
||||||
|
boolean f = false;
|
||||||
|
|
||||||
|
for(int i = 0; i < 10000; i++)
|
||||||
|
{
|
||||||
|
int x = (int) ((int) (29999983 / 1.2) * Math.random());
|
||||||
|
int z = (int) ((int) (29999983 / 1.2) * Math.random());
|
||||||
|
|
||||||
|
if(g.getBiome((int) g.getOffsetX(x, z), (int) g.getOffsetZ(x, z)).equals(b))
|
||||||
|
{
|
||||||
|
f = true;
|
||||||
|
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!f)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Couldn't for " + b.getName() + " in 10,000 different locations and could not find it. Try again!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris find biome <query>");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
||||||
|
|
||||||
|
public class CommandFindObject extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandFindObject()
|
||||||
|
{
|
||||||
|
super("object", "o");
|
||||||
|
setDescription("Teleport to an object by name");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
World w = null;
|
||||||
|
|
||||||
|
if(sender.isPlayer() && sender.player().getWorld().getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
w = sender.player().getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Console / Non-Iris World.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
if(args.length > 0)
|
||||||
|
{
|
||||||
|
PlacedObject o = ((IrisGenerator) w.getGenerator()).randomObject(args[0]);
|
||||||
|
|
||||||
|
if(o != null)
|
||||||
|
{
|
||||||
|
Location l = new Location(w, o.getX(), o.getY(), o.getZ());
|
||||||
|
p.teleport(l);
|
||||||
|
sender.sendMessage("Found Object " + C.DARK_GREEN + o.getF().replace(":", "/" + C.WHITE));
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Couldn't find any objects containing '" + args[0] + "' Either");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris find object <query>");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,132 +1,44 @@
|
|||||||
package ninja.bytecode.iris.command;
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import mortar.bukkit.command.Command;
|
||||||
import org.bukkit.ChatColor;
|
import mortar.bukkit.command.MortarCommand;
|
||||||
import org.bukkit.GameMode;
|
import mortar.bukkit.command.MortarSender;
|
||||||
import org.bukkit.Location;
|
import mortar.util.text.C;
|
||||||
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 ninja.bytecode.iris.Iris;
|
public class CommandIris extends MortarCommand
|
||||||
import ninja.bytecode.iris.controller.TimingsController;
|
|
||||||
import ninja.bytecode.iris.controller.WorldController;
|
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
|
||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
|
||||||
import ninja.bytecode.shuriken.format.Form;
|
|
||||||
|
|
||||||
public class CommandIris implements CommandExecutor
|
|
||||||
{
|
{
|
||||||
public void msg(CommandSender s, String msg)
|
@Command
|
||||||
|
private CommandTimings timings;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandWhat what;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandFind find;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandObject object;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandSelection selection;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandReload reload;
|
||||||
|
|
||||||
|
public CommandIris()
|
||||||
{
|
{
|
||||||
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
|
super("iris", "irs", "ir");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
{
|
{
|
||||||
if(args.length == 0)
|
for(MortarCommand i : getChildren())
|
||||||
{
|
{
|
||||||
msg(sender, "/iris timings - Iris Timings");
|
sender.sendMessage("/iris " + C.WHITE + i.getNode() + C.GRAY + (!i.getNodes().isEmpty() ? "," : "") + i.getNodes().toString(",") + " - " + C.DARK_GREEN + i.getDescription());
|
||||||
msg(sender, "/iris rtp [biome] - RTP to a biome");
|
|
||||||
msg(sender, "/iris gen - Gen a new Iris World");
|
|
||||||
msg(sender, "/ish - Iris Schematic Commands");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.length > 0)
|
return true;
|
||||||
{
|
|
||||||
if(args[0].equalsIgnoreCase("timings"))
|
|
||||||
{
|
|
||||||
double t = Iris.getController(TimingsController.class).getResult("terrain");
|
|
||||||
double d = Iris.getController(TimingsController.class).getResult("decor");
|
|
||||||
msg(sender, "Generation: " + ChatColor.BOLD + ChatColor.WHITE + Form.duration(t + d, 2));
|
|
||||||
msg(sender, " \\Terrain: " + ChatColor.BOLD + ChatColor.WHITE + Form.duration(t, 2));
|
|
||||||
msg(sender, " \\Decor: " + ChatColor.BOLD + ChatColor.WHITE + Form.duration(d, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("rtp"))
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
World w = p.getWorld();
|
|
||||||
|
|
||||||
if(w.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
if(args.length > 1)
|
|
||||||
{
|
|
||||||
IrisGenerator g = (IrisGenerator) w.getGenerator();
|
|
||||||
IrisBiome b = null;
|
|
||||||
for(IrisBiome i : g.getDimension().getBiomes())
|
|
||||||
{
|
|
||||||
if(args[1].toLowerCase().equals(i.getName().toLowerCase().replaceAll("\\Q \\E", "_")))
|
|
||||||
{
|
|
||||||
b = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(b == null)
|
|
||||||
{
|
|
||||||
msg(sender, "Unknown Biome: " + args[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg(sender, "Looking for " + b.getName() + "...");
|
|
||||||
boolean f = false;
|
|
||||||
for(int i = 0; i < 10000; i++)
|
|
||||||
{
|
|
||||||
int x = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
int z = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
|
|
||||||
if(g.getBiome(x, z).equals(b))
|
|
||||||
{
|
|
||||||
f = true;
|
|
||||||
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!f)
|
|
||||||
{
|
|
||||||
msg(sender, "Looked for " + b.getName() + " in 10,000 different locations and could not find it. Try again!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int x = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
int z = (int) ((int) (29999983 / 1.2) * Math.random());
|
|
||||||
p.teleport(w.getHighestBlockAt(x, z).getLocation());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("gen"))
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
World wold = ((Player) sender).getWorld();
|
|
||||||
World w = Iris.getController(WorldController.class).createIrisWorld(null, 0, true);
|
|
||||||
((Player) sender).teleport(new Location(w, 0, 256, 0));
|
|
||||||
((Player) sender).setFlying(true);
|
|
||||||
((Player) sender).setGameMode(GameMode.CREATIVE);
|
|
||||||
wold.setAutoSave(false);
|
|
||||||
Bukkit.unloadWorld(wold, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Iris.getController(WorldController.class).createIrisWorld(null, 0, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,261 +0,0 @@
|
|||||||
package ninja.bytecode.iris.command;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.Sound;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandExecutor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.util.Vector;
|
|
||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
|
||||||
import ninja.bytecode.iris.controller.WandController;
|
|
||||||
import ninja.bytecode.iris.generator.genobject.GenObject;
|
|
||||||
import ninja.bytecode.iris.util.Cuboid;
|
|
||||||
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
|
||||||
import ninja.bytecode.iris.util.Direction;
|
|
||||||
import ninja.bytecode.shuriken.format.Form;
|
|
||||||
|
|
||||||
public class CommandIsh implements CommandExecutor
|
|
||||||
{
|
|
||||||
public void msg(CommandSender s, String msg)
|
|
||||||
{
|
|
||||||
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
|
||||||
{
|
|
||||||
if(args.length == 0)
|
|
||||||
{
|
|
||||||
msg(sender, "/ish wand - Get an Iris Wand");
|
|
||||||
msg(sender, "/ish save <name> - Save Schematic");
|
|
||||||
msg(sender, "/ish load <name> [cursor] - Paste Schematic");
|
|
||||||
msg(sender, "/ish expand <amount> - Expand Cuboid in direction");
|
|
||||||
msg(sender, "/ish shift <amount> - Shift Cuboid in direction");
|
|
||||||
msg(sender, "/ish shrinkwrap - Shrink to blocks");
|
|
||||||
msg(sender, "/ish xup - Shift up, Expand up, Contract in.");
|
|
||||||
msg(sender, "/ish xvert - Expand up, Expand down, Contract in.");
|
|
||||||
msg(sender, "/ish id - What id am i looking at");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args.length > 0)
|
|
||||||
{
|
|
||||||
if(sender instanceof Player)
|
|
||||||
{
|
|
||||||
Player p = (Player) sender;
|
|
||||||
if(args[0].equalsIgnoreCase("wand"))
|
|
||||||
{
|
|
||||||
p.getInventory().addItem(WandController.createWand());
|
|
||||||
p.playSound(p.getLocation(), Sound.ITEM_ARMOR_EQUIP_DIAMOND, 1f, 1.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("id"))
|
|
||||||
{
|
|
||||||
|
|
||||||
Block b = p.getTargetBlock(null, 64);
|
|
||||||
msg(p, b.getType().getId() + ":" + b.getData() + " (" + b.getType().toString() + ":" + b.getData() + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("save"))
|
|
||||||
{
|
|
||||||
GenObject s = WandController.createSchematic(p.getInventory().getItemInMainHand(), p.getLocation());
|
|
||||||
File f = new File(Iris.instance.getDataFolder(), "schematics/" + args[1] + ".ish");
|
|
||||||
f.getParentFile().mkdirs();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileOutputStream fos = new FileOutputStream(f);
|
|
||||||
s.write(fos, true);
|
|
||||||
msg(p, "Saved " + args[1] + " (" + Form.f(s.getSchematic().size()) + " Entries)");
|
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 0.45f);
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("load"))
|
|
||||||
{
|
|
||||||
GenObject s = new GenObject(1, 1, 1);
|
|
||||||
File f = new File(Iris.instance.getDataFolder(), "schematics/" + args[1] + ".ish");
|
|
||||||
if(!f.exists())
|
|
||||||
{
|
|
||||||
msg(p, "Not Found");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileInputStream fin = new FileInputStream(f);
|
|
||||||
s.read(fin, true);
|
|
||||||
|
|
||||||
boolean cursor = false;
|
|
||||||
for(String i : args)
|
|
||||||
{
|
|
||||||
if(i.equalsIgnoreCase("cursor"))
|
|
||||||
{
|
|
||||||
cursor = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Location at = p.getLocation();
|
|
||||||
|
|
||||||
if(cursor)
|
|
||||||
{
|
|
||||||
at = p.getTargetBlock(null, 64).getLocation();
|
|
||||||
}
|
|
||||||
|
|
||||||
WandController.pasteSchematic(s, at);
|
|
||||||
p.playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.25f);
|
|
||||||
msg(p, "Pasted " + args[1] + " (" + Form.f(s.getSchematic().size()) + " Blocks Modified)");
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e1)
|
|
||||||
{
|
|
||||||
e1.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("xup"))
|
|
||||||
{
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
b[0].add(new Vector(0, 1, 0));
|
|
||||||
b[1].add(new Vector(0, 1, 0));
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
|
|
||||||
while(!cursor.containsOnly(Material.AIR))
|
|
||||||
{
|
|
||||||
a1.add(new Vector(0, 1, 0));
|
|
||||||
a2.add(new Vector(0, 1, 0));
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1.add(new Vector(0, -1, 0));
|
|
||||||
a2.add(new Vector(0, -1, 0));
|
|
||||||
b[0] = a1;
|
|
||||||
a2 = b[1];
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("shrinkwrap") || args[0].equalsIgnoreCase("shrink"))
|
|
||||||
{
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
cursor = cursor.contract(CuboidDirection.Up);
|
|
||||||
cursor = cursor.contract(CuboidDirection.Down);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("expand"))
|
|
||||||
{
|
|
||||||
int amt = Integer.valueOf(args[1]);
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
cursor = cursor.expand(d, amt);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("shift"))
|
|
||||||
{
|
|
||||||
int amt = Integer.valueOf(args[1]);
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
|
||||||
a1.add(d.toVector().multiply(amt));
|
|
||||||
a2.add(d.toVector().multiply(amt));
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args[0].equalsIgnoreCase("xvert"))
|
|
||||||
{
|
|
||||||
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
|
||||||
Location a1 = b[0].clone();
|
|
||||||
Location a2 = b[1].clone();
|
|
||||||
Location a1x = b[0].clone();
|
|
||||||
Location a2x = b[1].clone();
|
|
||||||
Cuboid cursor = new Cuboid(a1, a2);
|
|
||||||
Cuboid cursorx = new Cuboid(a1, a2);
|
|
||||||
|
|
||||||
while(!cursor.containsOnly(Material.AIR))
|
|
||||||
{
|
|
||||||
a1.add(new Vector(0, 1, 0));
|
|
||||||
a2.add(new Vector(0, 1, 0));
|
|
||||||
cursor = new Cuboid(a1, a2);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1.add(new Vector(0, -1, 0));
|
|
||||||
a2.add(new Vector(0, -1, 0));
|
|
||||||
|
|
||||||
while(!cursorx.containsOnly(Material.AIR))
|
|
||||||
{
|
|
||||||
a1x.add(new Vector(0, -1, 0));
|
|
||||||
a2x.add(new Vector(0, -1, 0));
|
|
||||||
cursorx = new Cuboid(a1x, a2x);
|
|
||||||
}
|
|
||||||
|
|
||||||
a1x.add(new Vector(0, 1, 0));
|
|
||||||
a2x.add(new Vector(0, 1, 0));
|
|
||||||
b[0] = a1;
|
|
||||||
b[1] = a2x;
|
|
||||||
cursor = new Cuboid(b[0], b[1]);
|
|
||||||
cursor = cursor.contract(CuboidDirection.North);
|
|
||||||
cursor = cursor.contract(CuboidDirection.South);
|
|
||||||
cursor = cursor.contract(CuboidDirection.East);
|
|
||||||
cursor = cursor.contract(CuboidDirection.West);
|
|
||||||
b[0] = cursor.getLowerNE();
|
|
||||||
b[1] = cursor.getUpperSW();
|
|
||||||
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
|
||||||
p.updateInventory();
|
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
36
src/main/java/ninja/bytecode/iris/command/CommandObject.java
Normal file
36
src/main/java/ninja/bytecode/iris/command/CommandObject.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.Command;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
|
||||||
|
public class CommandObject extends MortarCommand
|
||||||
|
{
|
||||||
|
@Command
|
||||||
|
private CommandObjectWand oWand;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandObjectLoad oLoad;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandObjectSave oSave;
|
||||||
|
|
||||||
|
public CommandObject()
|
||||||
|
{
|
||||||
|
super("object", "o");
|
||||||
|
setDescription("Object Subcommands");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
for(MortarCommand i : getChildren())
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris object " + C.WHITE + i.getNode() + C.GRAY + (!i.getNodes().isEmpty() ? "," : "") + i.getNodes().toString(",") + " - " + C.DARK_GREEN + i.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
106
src/main/java/ninja/bytecode/iris/command/CommandObjectLoad.java
Normal file
106
src/main/java/ninja/bytecode/iris/command/CommandObjectLoad.java
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.Iris;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
|
import ninja.bytecode.iris.util.Direction;
|
||||||
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
|
|
||||||
|
public class CommandObjectLoad extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandObjectLoad()
|
||||||
|
{
|
||||||
|
super("load", "l");
|
||||||
|
setDescription("Load & Paste an object");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length < 1)
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris object load <name>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
GenObject s = new GenObject(1, 1, 1);
|
||||||
|
File f = new File(Iris.instance.getDataFolder(), "schematics/" + args[0] + ".ish");
|
||||||
|
if(!f.exists())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Can't find " + args[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileInputStream fin = new FileInputStream(f);
|
||||||
|
s.read(fin, true);
|
||||||
|
|
||||||
|
boolean cursor = false;
|
||||||
|
Direction df = null;
|
||||||
|
Direction dt = null;
|
||||||
|
|
||||||
|
for(String i : args)
|
||||||
|
{
|
||||||
|
if(i.equalsIgnoreCase("cursor"))
|
||||||
|
{
|
||||||
|
cursor = true;
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Rotating " + C.WHITE + df + C.GRAY + " to " + C.WHITE + dt);
|
||||||
|
s.rotate(df, dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Location at = p.getLocation();
|
||||||
|
|
||||||
|
if(cursor)
|
||||||
|
{
|
||||||
|
at = p.getTargetBlock(null, 64).getLocation();
|
||||||
|
}
|
||||||
|
|
||||||
|
WandController.pasteSchematic(s, at);
|
||||||
|
p.playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 1.25f);
|
||||||
|
sender.sendMessage("Pasted " + args[0] + " (" + Form.f(s.getSchematic().size()) + " Blocks Modified)");
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e1)
|
||||||
|
{
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.Iris;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
|
|
||||||
|
public class CommandObjectSave extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandObjectSave()
|
||||||
|
{
|
||||||
|
super("save", "s");
|
||||||
|
setDescription("Save an object");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length < 1)
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris object save <name>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
GenObject s = WandController.createSchematic(p.getInventory().getItemInMainHand(), p.getLocation());
|
||||||
|
|
||||||
|
if(s == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Hold your wand while using this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
File f = new File(Iris.instance.getDataFolder(), "schematics/" + args[0] + ".ish");
|
||||||
|
f.getParentFile().mkdirs();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileOutputStream fos = new FileOutputStream(f);
|
||||||
|
s.write(fos, true);
|
||||||
|
p.sendMessage("Saved " + args[1] + " (" + Form.f(s.getSchematic().size()) + " Entries)");
|
||||||
|
p.playSound(p.getLocation(), Sound.BLOCK_ENCHANTMENT_TABLE_USE, 1f, 0.45f);
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e1)
|
||||||
|
{
|
||||||
|
p.sendMessage("Failed. Check the console!");
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
|
||||||
|
public class CommandObjectWand extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandObjectWand()
|
||||||
|
{
|
||||||
|
super("wand", "w");
|
||||||
|
setDescription("Obtain Iris Wand");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.player().getInventory().addItem(WandController.createWand());
|
||||||
|
sender.player().playSound(sender.player().getLocation(), Sound.ITEM_ARMOR_EQUIP_DIAMOND, 1f, 1.55f);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
src/main/java/ninja/bytecode/iris/command/CommandReload.java
Normal file
36
src/main/java/ninja/bytecode/iris/command/CommandReload.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.Command;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
|
||||||
|
public class CommandReload extends MortarCommand
|
||||||
|
{
|
||||||
|
@Command
|
||||||
|
private CommandReloadPack rThis;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandReloadChunks rChunks;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandReloadIris rIris;
|
||||||
|
|
||||||
|
public CommandReload()
|
||||||
|
{
|
||||||
|
super("reload", "r");
|
||||||
|
setDescription("Reload Chunks / Pack / Iris");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
for(MortarCommand i : getChildren())
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris reload " + C.WHITE + i.getNode() + C.GRAY + (!i.getNodes().isEmpty() ? "," : "") + i.getNodes().toString(",") + " - " + C.DARK_GREEN + i.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.api.nms.NMP;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
|
||||||
|
public class CommandReloadChunks extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandReloadChunks()
|
||||||
|
{
|
||||||
|
super("chunks", "c");
|
||||||
|
setDescription("Resends chunk packets.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Again, You don't have a position. Stop it.");
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage("Resending Chunks in your view distance.");
|
||||||
|
Player p = ((Player) sender);
|
||||||
|
|
||||||
|
for(Chunk i : p.getWorld().getLoadedChunks())
|
||||||
|
{
|
||||||
|
NMP.CHUNK.refresh(p, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.Iris;
|
||||||
|
|
||||||
|
public class CommandReloadIris extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandReloadIris()
|
||||||
|
{
|
||||||
|
super("iris", "i");
|
||||||
|
setDescription("Reloads Iris");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
Iris.instance.reload();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
142
src/main/java/ninja/bytecode/iris/command/CommandReloadPack.java
Normal file
142
src/main/java/ninja/bytecode/iris/command/CommandReloadPack.java
Normal file
@ -0,0 +1,142 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.api.sched.J;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.logic.queue.ChronoLatch;
|
||||||
|
import ninja.bytecode.iris.Iris;
|
||||||
|
import ninja.bytecode.iris.controller.PackController;
|
||||||
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
|
import ninja.bytecode.iris.generator.WorldReactor;
|
||||||
|
import ninja.bytecode.iris.pack.CompiledDimension;
|
||||||
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
|
import ninja.bytecode.shuriken.collections.KMap;
|
||||||
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
|
|
||||||
|
public class CommandReloadPack extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandReloadPack()
|
||||||
|
{
|
||||||
|
super("pack", "p");
|
||||||
|
setDescription("Reloads the pack + regen");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
sender.sendMessage("=== Hotloading Pack ===");
|
||||||
|
PackController c = Iris.pack();
|
||||||
|
KMap<String, String> f = new KMap<>();
|
||||||
|
|
||||||
|
for(World i : Bukkit.getWorlds())
|
||||||
|
{
|
||||||
|
if(i.getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
String n = ((IrisGenerator) i.getGenerator()).getDimension().getName();
|
||||||
|
sender.sendMessage("Preparing " + n);
|
||||||
|
f.put(i.getName(), n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(f.isEmpty())
|
||||||
|
{
|
||||||
|
sender.sendMessage("No Worlds to inject!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
J.a(() ->
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Consumer<String> m = (msg) ->
|
||||||
|
{
|
||||||
|
J.s(() ->
|
||||||
|
{
|
||||||
|
String mm = msg;
|
||||||
|
|
||||||
|
if(msg.contains("|"))
|
||||||
|
{
|
||||||
|
KList<String> fx = new KList<>();
|
||||||
|
fx.add(msg.split("\\Q|\\E"));
|
||||||
|
fx.remove(0);
|
||||||
|
fx.remove(0);
|
||||||
|
mm = fx.toString("");
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage(mm.replaceAll("\\Q \\E", ""));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
L.addLogConsumer(m);
|
||||||
|
c.compile();
|
||||||
|
L.logConsumers.remove(m);
|
||||||
|
|
||||||
|
J.s(() ->
|
||||||
|
{
|
||||||
|
if(sender.isPlayer())
|
||||||
|
{
|
||||||
|
ChronoLatch cl = new ChronoLatch(3000);
|
||||||
|
Player p = sender.player();
|
||||||
|
World ww = sender.player().getWorld();
|
||||||
|
|
||||||
|
sender.sendMessage("Regenerating View Distance");
|
||||||
|
|
||||||
|
WorldReactor r = new WorldReactor(ww);
|
||||||
|
r.generateRegionNormal(p, true, 200, (pct) ->
|
||||||
|
{
|
||||||
|
if(cl.flip())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Regenerating " + Form.pc(pct));
|
||||||
|
}
|
||||||
|
}, () ->
|
||||||
|
{
|
||||||
|
sender.sendMessage("Done! Use F3 + A");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, 5);
|
||||||
|
|
||||||
|
for(String fi : f.k())
|
||||||
|
{
|
||||||
|
J.s(() ->
|
||||||
|
{
|
||||||
|
World i = Bukkit.getWorld(fi);
|
||||||
|
CompiledDimension dim = c.getDimension(f.get(fi));
|
||||||
|
|
||||||
|
for(String k : c.getDimensions().k())
|
||||||
|
{
|
||||||
|
if(c.getDimension(k).getName().equals(f.get(fi)))
|
||||||
|
{
|
||||||
|
dim = c.getDimension(k);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(dim == null)
|
||||||
|
{
|
||||||
|
J.s(() -> sender.sendMessage("Cannot find dimnension: " + f.get(fi)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sender.sendMessage("Hotloaded " + i.getName());
|
||||||
|
IrisGenerator g = ((IrisGenerator) i.getGenerator());
|
||||||
|
g.inject(dim);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,42 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.Command;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
|
||||||
|
public class CommandSelection extends MortarCommand
|
||||||
|
{
|
||||||
|
@Command
|
||||||
|
private CommandSelectionExpand expand;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandSelectionShift shift;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandSelectionShrink shr;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandSelectionXUp xip;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandSelectionXVert xvc;
|
||||||
|
|
||||||
|
public CommandSelection()
|
||||||
|
{
|
||||||
|
super("selection", "sel", "s");
|
||||||
|
setDescription("Wand Selection Subcommands");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
for(MortarCommand i : getChildren())
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris sel " + C.WHITE + i.getNode() + C.GRAY + (!i.getNodes().isEmpty() ? "," : "") + i.getNodes().toString(",") + " - " + C.DARK_GREEN + i.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
|
import ninja.bytecode.iris.util.Direction;
|
||||||
|
|
||||||
|
public class CommandSelectionExpand extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandSelectionExpand()
|
||||||
|
{
|
||||||
|
super("expand", "+");
|
||||||
|
setDescription("Expand in looking direction");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
if(!WandController.isWand(p))
|
||||||
|
{
|
||||||
|
sender.sendMessage("Ready your Wand.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 0)
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris selection expand <amount>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int amt = Integer.valueOf(args[0]);
|
||||||
|
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
|
Location a1 = b[0].clone();
|
||||||
|
Location a2 = b[1].clone();
|
||||||
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
|
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
||||||
|
cursor = cursor.expand(d, amt);
|
||||||
|
b[0] = cursor.getLowerNE();
|
||||||
|
b[1] = cursor.getUpperSW();
|
||||||
|
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||||
|
p.updateInventory();
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
|
import ninja.bytecode.iris.util.Direction;
|
||||||
|
|
||||||
|
public class CommandSelectionShift extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandSelectionShift()
|
||||||
|
{
|
||||||
|
super("shift", ">");
|
||||||
|
setDescription("Shift looking direction");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
if(!WandController.isWand(p))
|
||||||
|
{
|
||||||
|
sender.sendMessage("Ready your Wand.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(args.length == 0)
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris selection shift <amount>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int amt = Integer.valueOf(args[0]);
|
||||||
|
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
|
Location a1 = b[0].clone();
|
||||||
|
Location a2 = b[1].clone();
|
||||||
|
Direction d = Direction.closest(p.getLocation().getDirection()).reverse();
|
||||||
|
a1.add(d.toVector().multiply(amt));
|
||||||
|
a2.add(d.toVector().multiply(amt));
|
||||||
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
|
b[0] = cursor.getLowerNE();
|
||||||
|
b[1] = cursor.getUpperSW();
|
||||||
|
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||||
|
p.updateInventory();
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,57 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
||||||
|
|
||||||
|
public class CommandSelectionShrink extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandSelectionShrink()
|
||||||
|
{
|
||||||
|
super("shrinkwrap", "shrink");
|
||||||
|
setDescription("Match blocks boundary");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
if(!WandController.isWand(p))
|
||||||
|
{
|
||||||
|
sender.sendMessage("Ready your Wand.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
|
Location a1 = b[0].clone();
|
||||||
|
Location a2 = b[1].clone();
|
||||||
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
|
cursor = cursor.contract(CuboidDirection.North);
|
||||||
|
cursor = cursor.contract(CuboidDirection.South);
|
||||||
|
cursor = cursor.contract(CuboidDirection.East);
|
||||||
|
cursor = cursor.contract(CuboidDirection.West);
|
||||||
|
cursor = cursor.contract(CuboidDirection.Up);
|
||||||
|
cursor = cursor.contract(CuboidDirection.Down);
|
||||||
|
b[0] = cursor.getLowerNE();
|
||||||
|
b[1] = cursor.getUpperSW();
|
||||||
|
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||||
|
p.updateInventory();
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,72 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
||||||
|
|
||||||
|
public class CommandSelectionXUp extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandSelectionXUp()
|
||||||
|
{
|
||||||
|
super("expandup", "xup");
|
||||||
|
setDescription("Expand Up & Trim In");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
if(!WandController.isWand(p))
|
||||||
|
{
|
||||||
|
sender.sendMessage("Ready your Wand.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
|
b[0].add(new Vector(0, 1, 0));
|
||||||
|
b[1].add(new Vector(0, 1, 0));
|
||||||
|
Location a1 = b[0].clone();
|
||||||
|
Location a2 = b[1].clone();
|
||||||
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
|
|
||||||
|
while(!cursor.containsOnly(Material.AIR))
|
||||||
|
{
|
||||||
|
a1.add(new Vector(0, 1, 0));
|
||||||
|
a2.add(new Vector(0, 1, 0));
|
||||||
|
cursor = new Cuboid(a1, a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
a1.add(new Vector(0, -1, 0));
|
||||||
|
a2.add(new Vector(0, -1, 0));
|
||||||
|
b[0] = a1;
|
||||||
|
a2 = b[1];
|
||||||
|
cursor = new Cuboid(a1, a2);
|
||||||
|
cursor = cursor.contract(CuboidDirection.North);
|
||||||
|
cursor = cursor.contract(CuboidDirection.South);
|
||||||
|
cursor = cursor.contract(CuboidDirection.East);
|
||||||
|
cursor = cursor.contract(CuboidDirection.West);
|
||||||
|
b[0] = cursor.getLowerNE();
|
||||||
|
b[1] = cursor.getUpperSW();
|
||||||
|
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||||
|
p.updateInventory();
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,83 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import ninja.bytecode.iris.controller.WandController;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
|
import ninja.bytecode.iris.util.Cuboid.CuboidDirection;
|
||||||
|
|
||||||
|
public class CommandSelectionXVert extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandSelectionXVert()
|
||||||
|
{
|
||||||
|
super("expandvertical", "xvert");
|
||||||
|
setDescription("Expand Up + Down & Trim In");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Players Only");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
|
||||||
|
if(!WandController.isWand(p))
|
||||||
|
{
|
||||||
|
sender.sendMessage("Ready your Wand.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Location[] b = WandController.getCuboid(p.getInventory().getItemInMainHand());
|
||||||
|
Location a1 = b[0].clone();
|
||||||
|
Location a2 = b[1].clone();
|
||||||
|
Location a1x = b[0].clone();
|
||||||
|
Location a2x = b[1].clone();
|
||||||
|
Cuboid cursor = new Cuboid(a1, a2);
|
||||||
|
Cuboid cursorx = new Cuboid(a1, a2);
|
||||||
|
|
||||||
|
while(!cursor.containsOnly(Material.AIR))
|
||||||
|
{
|
||||||
|
a1.add(new Vector(0, 1, 0));
|
||||||
|
a2.add(new Vector(0, 1, 0));
|
||||||
|
cursor = new Cuboid(a1, a2);
|
||||||
|
}
|
||||||
|
|
||||||
|
a1.add(new Vector(0, -1, 0));
|
||||||
|
a2.add(new Vector(0, -1, 0));
|
||||||
|
|
||||||
|
while(!cursorx.containsOnly(Material.AIR))
|
||||||
|
{
|
||||||
|
a1x.add(new Vector(0, -1, 0));
|
||||||
|
a2x.add(new Vector(0, -1, 0));
|
||||||
|
cursorx = new Cuboid(a1x, a2x);
|
||||||
|
}
|
||||||
|
|
||||||
|
a1x.add(new Vector(0, 1, 0));
|
||||||
|
a2x.add(new Vector(0, 1, 0));
|
||||||
|
b[0] = a1;
|
||||||
|
b[1] = a2x;
|
||||||
|
cursor = new Cuboid(b[0], b[1]);
|
||||||
|
cursor = cursor.contract(CuboidDirection.North);
|
||||||
|
cursor = cursor.contract(CuboidDirection.South);
|
||||||
|
cursor = cursor.contract(CuboidDirection.East);
|
||||||
|
cursor = cursor.contract(CuboidDirection.West);
|
||||||
|
b[0] = cursor.getLowerNE();
|
||||||
|
b[1] = cursor.getUpperSW();
|
||||||
|
p.getInventory().setItemInMainHand(WandController.createWand(b[0], b[1]));
|
||||||
|
p.updateInventory();
|
||||||
|
p.playSound(p.getLocation(), Sound.ENTITY_ITEMFRAME_ROTATE_ITEM, 1f, 0.55f);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
|
|
||||||
|
public class CommandTimings extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandTimings()
|
||||||
|
{
|
||||||
|
super("timings", "t");
|
||||||
|
setDescription("Tick use on a per chunk basis");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
World world = null;
|
||||||
|
|
||||||
|
if(sender.isPlayer() && sender.player().getWorld().getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
world = sender.player().getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(args.length >= 1)
|
||||||
|
{
|
||||||
|
World t = Bukkit.getWorld(args[0]);
|
||||||
|
|
||||||
|
if(t == null)
|
||||||
|
{
|
||||||
|
sender.sendMessage("Unknown world " + args[0]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
else if(t.getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
world = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Console / Non-Iris World. " + C.WHITE + "Use /iris timings <world>");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
((IrisGenerator) world.getGenerator()).getMetrics().send(sender, (m) -> sender.sendMessage(m));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
36
src/main/java/ninja/bytecode/iris/command/CommandWhat.java
Normal file
36
src/main/java/ninja/bytecode/iris/command/CommandWhat.java
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.Command;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
|
||||||
|
public class CommandWhat extends MortarCommand
|
||||||
|
{
|
||||||
|
@Command
|
||||||
|
private CommandWhatBiome wBiome;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandWhatObject wObject;
|
||||||
|
|
||||||
|
@Command
|
||||||
|
private CommandWhatBlock wBlock;
|
||||||
|
|
||||||
|
public CommandWhat()
|
||||||
|
{
|
||||||
|
super("what", "w");
|
||||||
|
setDescription("Identify what you are looking at.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
for(MortarCommand i : getChildren())
|
||||||
|
{
|
||||||
|
sender.sendMessage("/iris what " + C.WHITE + i.getNode() + C.GRAY + (!i.getNodes().isEmpty() ? "," : "") + i.getNodes().toString(",") + " - " + C.DARK_GREEN + i.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
|
import ninja.bytecode.iris.util.BiomeLayer;
|
||||||
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
|
|
||||||
|
public class CommandWhatBiome extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandWhatBiome()
|
||||||
|
{
|
||||||
|
super("biome", "b");
|
||||||
|
setDescription("Identify Current Biome");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
World world = null;
|
||||||
|
|
||||||
|
if(sender.isPlayer() && sender.player().getWorld().getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
world = sender.player().getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Console / Non-Iris World.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
IrisGenerator g = (IrisGenerator) world.getGenerator();
|
||||||
|
IrisBiome biome = g.getBiome((int) g.getOffsetX(p.getLocation().getX(), p.getLocation().getZ()), (int) g.getOffsetZ(p.getLocation().getX(), p.getLocation().getZ()));
|
||||||
|
BiomeLayer l = new BiomeLayer(g, biome);
|
||||||
|
sender.sendMessage("Biome: " + C.BOLD + C.WHITE + biome.getName() + C.RESET + C.GRAY + " (" + C.GOLD + l.getBiome().getRarityString() + C.GRAY + ")");
|
||||||
|
|
||||||
|
for(String i : biome.getSchematicGroups().k())
|
||||||
|
{
|
||||||
|
String f = "";
|
||||||
|
double percent = biome.getSchematicGroups().get(i);
|
||||||
|
|
||||||
|
if(percent > 1D)
|
||||||
|
{
|
||||||
|
f = (int) percent + " + " + Form.pc(percent - (int) percent, percent - (int) percent >= 0.01 ? 0 : 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f = Form.pc(percent, percent >= 0.01 ? 0 : 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.sendMessage("* " + C.DARK_GREEN + i + ": " + C.BOLD + C.WHITE + f + C.RESET + C.GRAY + " (" + Form.f(g.getDimension().getObjectGroup(i).size()) + " variants)");
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
|
||||||
|
public class CommandWhatBlock extends MortarCommand
|
||||||
|
{
|
||||||
|
public CommandWhatBlock()
|
||||||
|
{
|
||||||
|
super("block", "id", "i");
|
||||||
|
setDescription("Identify Current Block Looking at");
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
if(!sender.isPlayer())
|
||||||
|
{
|
||||||
|
sender.sendMessage("Not sure where you are looking.");
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
Block b = p.getTargetBlock(null, 64);
|
||||||
|
sender.sendMessage(b.getType().getId() + ":" + b.getData() + " (" + b.getType().toString() + ":" + b.getData() + ")");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
165
src/main/java/ninja/bytecode/iris/command/CommandWhatObject.java
Normal file
165
src/main/java/ninja/bytecode/iris/command/CommandWhatObject.java
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
package ninja.bytecode.iris.command;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import mortar.api.sched.SR;
|
||||||
|
import mortar.bukkit.command.MortarCommand;
|
||||||
|
import mortar.bukkit.command.MortarSender;
|
||||||
|
import mortar.lang.collection.FinalInteger;
|
||||||
|
import mortar.util.text.C;
|
||||||
|
import ninja.bytecode.iris.Iris;
|
||||||
|
import ninja.bytecode.iris.generator.IrisGenerator;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.GenObjectGroup;
|
||||||
|
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
||||||
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
|
import ninja.bytecode.shuriken.collections.KMap;
|
||||||
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
|
|
||||||
|
public class CommandWhatObject extends MortarCommand
|
||||||
|
{
|
||||||
|
private KMap<String, GenObject> goc;
|
||||||
|
private KMap<String, GenObjectGroup> gog;
|
||||||
|
|
||||||
|
public CommandWhatObject()
|
||||||
|
{
|
||||||
|
super("object", "o");
|
||||||
|
setDescription("WAYLA For Objects");
|
||||||
|
goc = new KMap<>();
|
||||||
|
gog = new KMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(MortarSender sender, String[] args)
|
||||||
|
{
|
||||||
|
World world = null;
|
||||||
|
|
||||||
|
if(sender.isPlayer() && sender.player().getWorld().getGenerator() instanceof IrisGenerator)
|
||||||
|
{
|
||||||
|
world = sender.player().getWorld();
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sender.sendMessage("Console / Non-Iris World.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = sender.player();
|
||||||
|
IrisGenerator generator = (IrisGenerator) world.getGenerator();
|
||||||
|
Location l = p.getTargetBlock(null, 32).getLocation();
|
||||||
|
PlacedObject po = generator.nearest(l, 12);
|
||||||
|
|
||||||
|
if(po != null)
|
||||||
|
{
|
||||||
|
if(!goc.containsKey(po.getF()))
|
||||||
|
{
|
||||||
|
String root = po.getF().split("\\Q:\\E")[0];
|
||||||
|
String n = po.getF().split("\\Q:\\E")[1];
|
||||||
|
GenObjectGroup gg = generator.getDimension().getObjectGroup(root);
|
||||||
|
gog.put(root, gg);
|
||||||
|
|
||||||
|
for(GenObject i : gg.getSchematics())
|
||||||
|
{
|
||||||
|
if(i.getName().equals(n))
|
||||||
|
{
|
||||||
|
goc.put(po.getF(), i);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!goc.containsKey(po.getF()))
|
||||||
|
{
|
||||||
|
goc.put(po.getF(), new GenObject(0, 0, 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GenObjectGroup ggg = gog.get(po.getF().split("\\Q:\\E")[0]);
|
||||||
|
GenObject g = goc.get(po.getF());
|
||||||
|
|
||||||
|
if(g != null)
|
||||||
|
{
|
||||||
|
Location point = new Location(l.getWorld(), po.getX(), po.getY(), po.getZ());
|
||||||
|
IrisBiome biome = generator.getBiome((int) generator.getOffsetX(po.getX(), po.getZ()), (int) generator.getOffsetZ(po.getX(), po.getZ()));
|
||||||
|
String gg = po.getF().split("\\Q:\\E")[0];
|
||||||
|
|
||||||
|
p.sendMessage(C.DARK_GREEN + C.BOLD.toString() + gg + C.GRAY + "/" + C.RESET + C.ITALIC + C.GRAY + g.getName() + C.RESET + C.WHITE + " (1 of " + Form.f(generator.getDimension().getObjectGroup(gg).size()) + " variants)");
|
||||||
|
|
||||||
|
if(biome.getSchematicGroups().containsKey(gg))
|
||||||
|
{
|
||||||
|
String f = "";
|
||||||
|
double percent = biome.getSchematicGroups().get(gg);
|
||||||
|
|
||||||
|
if(percent > 1D)
|
||||||
|
{
|
||||||
|
f = (int) percent + " + " + Form.pc(percent - (int) percent, percent - (int) percent >= 0.01 ? 0 : 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
f = Form.pc(percent, percent >= 0.01 ? 0 : 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
p.sendMessage(C.GOLD + "Spawn Chance in " + C.YELLOW + biome.getName() + C.RESET + ": " + C.BOLD + C.WHITE + f);
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int a = 0;
|
||||||
|
int b = 0;
|
||||||
|
double c = 0;
|
||||||
|
|
||||||
|
for(GenObject i : ggg.getSchematics())
|
||||||
|
{
|
||||||
|
a += i.getSuccesses();
|
||||||
|
b += i.getPlaces();
|
||||||
|
}
|
||||||
|
|
||||||
|
c = ((double) a / (double) b);
|
||||||
|
p.sendMessage(C.GRAY + "Grp: " + C.DARK_AQUA + Form.f(a) + C.GRAY + " of " + C.AQUA + Form.f(b) + C.GRAY + " placements (" + C.DARK_AQUA + Form.pc(c, 0) + C.GRAY + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
catch(Throwable e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
p.sendMessage(C.GRAY + "Var: " + C.DARK_AQUA + Form.f(g.getSuccesses()) + C.GRAY + " of " + C.AQUA + Form.f(g.getPlaces()) + C.GRAY + " placements (" + C.DARK_AQUA + Form.pc(g.getSuccess(), 0) + C.GRAY + ")");
|
||||||
|
|
||||||
|
for(String i : ggg.getFlags())
|
||||||
|
{
|
||||||
|
p.sendMessage(C.GRAY + "- " + C.DARK_PURPLE + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
FinalInteger fi = new FinalInteger(125);
|
||||||
|
|
||||||
|
new SR()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
if(point.distanceSquared(p.getLocation()) > 64 * 64)
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
fi.sub(1);
|
||||||
|
Iris.wand().draw(new Location[] {point.clone().add(g.getW() / 2, g.getH() / 2, g.getD() / 2), point.clone().subtract(g.getW() / 2, g.getH() / 2, g.getD() / 2)
|
||||||
|
}, p);
|
||||||
|
|
||||||
|
if(fi.get() <= 0)
|
||||||
|
{
|
||||||
|
cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,103 +0,0 @@
|
|||||||
package ninja.bytecode.iris.controller;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.Location;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import mortar.util.text.C;
|
|
||||||
import ninja.bytecode.iris.Iris;
|
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
|
||||||
import ninja.bytecode.shuriken.collections.KSet;
|
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
|
||||||
|
|
||||||
public class DebugController implements IrisController
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () ->
|
|
||||||
{
|
|
||||||
if(Iris.settings.performance.debugMode)
|
|
||||||
{
|
|
||||||
J.a(() ->
|
|
||||||
{
|
|
||||||
J.a(() ->
|
|
||||||
{
|
|
||||||
J.sleep(1000);
|
|
||||||
while(!Iris.getController(PackController.class).isReady())
|
|
||||||
{
|
|
||||||
J.sleep(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () ->
|
|
||||||
{
|
|
||||||
if(Iris.settings.performance.debugMode)
|
|
||||||
{
|
|
||||||
KSet<String> ws = new KSet<>();
|
|
||||||
KList<World> destroy = new KList<>();
|
|
||||||
|
|
||||||
for(World i : Bukkit.getWorlds())
|
|
||||||
{
|
|
||||||
if(i.getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
destroy.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
World w = Iris.getController(WorldController.class).createIrisWorld(null, 0, true);
|
|
||||||
for(Player i : Bukkit.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
Location m = i.getLocation();
|
|
||||||
ws.add(i.getWorld().getName());
|
|
||||||
i.teleport(new Location(w, m.getX(), m.getY(), m.getZ(), m.getYaw(), m.getPitch()));
|
|
||||||
i.setFlying(true);
|
|
||||||
i.setGameMode(GameMode.SPECTATOR);
|
|
||||||
|
|
||||||
if(Iris.settings.performance.fastMode)
|
|
||||||
{
|
|
||||||
msg(i, C.GOLD + "Fast Mode is ON!");
|
|
||||||
msg(i, "* Terrain is not interpolated");
|
|
||||||
msg(i, "* Schematics larger than 3 chunks may be clipped");
|
|
||||||
msg(i, "* Underground Generation is disabled");
|
|
||||||
msg(i, "* Surface Lighting is skipped");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for(String i : ws)
|
|
||||||
{
|
|
||||||
Bukkit.unloadWorld(i, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () ->
|
|
||||||
{
|
|
||||||
for(World i : destroy.copy())
|
|
||||||
{
|
|
||||||
Bukkit.unloadWorld(i, false);
|
|
||||||
}
|
|
||||||
}, 20);
|
|
||||||
}
|
|
||||||
}, 1);
|
|
||||||
});
|
|
||||||
Iris.getController(PackController.class).compile();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void msg(CommandSender s, String msg)
|
|
||||||
{
|
|
||||||
s.sendMessage(ChatColor.DARK_PURPLE + "[" + ChatColor.GRAY + "Iris" + ChatColor.DARK_PURPLE + "]" + ChatColor.GRAY + ": " + msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,34 +2,49 @@ package ninja.bytecode.iris.controller;
|
|||||||
|
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
|
import mortar.bukkit.plugin.Controller;
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.shuriken.collections.KMap;
|
import ninja.bytecode.shuriken.collections.KMap;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
||||||
|
|
||||||
public class ExecutionController implements IrisController
|
public class ExecutionController extends Controller
|
||||||
{
|
{
|
||||||
KMap<String, TaskExecutor> executors;
|
KMap<String, TaskExecutor> executors;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void start()
|
||||||
{
|
{
|
||||||
executors = new KMap<>();
|
executors = new KMap<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop()
|
public void stop()
|
||||||
{
|
{
|
||||||
for(TaskExecutor i : executors.v())
|
for(TaskExecutor i : executors.v())
|
||||||
{
|
{
|
||||||
i.close();
|
i.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
executors.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskExecutor getExecutor(World world, String f)
|
public TaskExecutor getExecutor(World world, String f)
|
||||||
{
|
{
|
||||||
|
String k = world.getWorldFolder().getAbsolutePath() + " (" + world + ") " + f;
|
||||||
|
|
||||||
|
if(executors.containsKey(k))
|
||||||
|
{
|
||||||
|
return executors.get(k);
|
||||||
|
}
|
||||||
|
|
||||||
TaskExecutor x = new TaskExecutor(getTC(), Iris.settings.performance.threadPriority, "Iris " + f);
|
TaskExecutor x = new TaskExecutor(getTC(), Iris.settings.performance.threadPriority, "Iris " + f);
|
||||||
executors.put(world.getWorldFolder().getAbsolutePath() + " (" + world + ") " + f, x);
|
executors.put(k, x);
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ import java.io.FileInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import mortar.bukkit.plugin.Controller;
|
||||||
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.generator.genobject.GenObject;
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
@ -13,7 +14,6 @@ import ninja.bytecode.iris.pack.CompiledDimension;
|
|||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
import ninja.bytecode.iris.pack.IrisBiome;
|
||||||
import ninja.bytecode.iris.pack.IrisDimension;
|
import ninja.bytecode.iris.pack.IrisDimension;
|
||||||
import ninja.bytecode.iris.pack.IrisPack;
|
import ninja.bytecode.iris.pack.IrisPack;
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
|
import ninja.bytecode.shuriken.bench.PrecisionStopwatch;
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.collections.KMap;
|
import ninja.bytecode.shuriken.collections.KMap;
|
||||||
@ -24,7 +24,7 @@ import ninja.bytecode.shuriken.json.JSONException;
|
|||||||
import ninja.bytecode.shuriken.json.JSONObject;
|
import ninja.bytecode.shuriken.json.JSONObject;
|
||||||
import ninja.bytecode.shuriken.logging.L;
|
import ninja.bytecode.shuriken.logging.L;
|
||||||
|
|
||||||
public class PackController implements IrisController
|
public class PackController extends Controller
|
||||||
{
|
{
|
||||||
private KMap<String, CompiledDimension> compiledDimensions;
|
private KMap<String, CompiledDimension> compiledDimensions;
|
||||||
private KMap<String, IrisDimension> dimensions;
|
private KMap<String, IrisDimension> dimensions;
|
||||||
@ -33,7 +33,7 @@ public class PackController implements IrisController
|
|||||||
private boolean ready;
|
private boolean ready;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void start()
|
||||||
{
|
{
|
||||||
compiledDimensions = new KMap<>();
|
compiledDimensions = new KMap<>();
|
||||||
dimensions = new KMap<>();
|
dimensions = new KMap<>();
|
||||||
@ -43,7 +43,13 @@ public class PackController implements IrisController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop()
|
public void stop()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -210,7 +216,7 @@ public class PackController implements IrisController
|
|||||||
|
|
||||||
if(g != null)
|
if(g != null)
|
||||||
{
|
{
|
||||||
Iris.getController(PackController.class).genObjectGroups.put(s, g);
|
genObjectGroups.put(s, g);
|
||||||
return g;
|
return g;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -298,7 +304,7 @@ public class PackController implements IrisController
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
biomes.put(id, Iris.getController(PackController.class).loadBiome(id));
|
biomes.put(id, ((PackController) Iris.instance.getController(PackController.class)).loadBiome(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(JSONException | IOException e)
|
catch(JSONException | IOException e)
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
package ninja.bytecode.iris.controller;
|
|
||||||
|
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.shuriken.bench.Profiler;
|
|
||||||
|
|
||||||
public class TimingsController implements IrisController
|
|
||||||
{
|
|
||||||
public Profiler profiler;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
profiler = new Profiler(768);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void started(String obj)
|
|
||||||
{
|
|
||||||
profiler.start(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stopped(String obj)
|
|
||||||
{
|
|
||||||
profiler.stop(obj);
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getResult(String tag)
|
|
||||||
{
|
|
||||||
return profiler.getResult(tag).getAverage();
|
|
||||||
}
|
|
||||||
}
|
|
@ -21,33 +21,21 @@ import org.bukkit.inventory.meta.ItemMeta;
|
|||||||
import org.bukkit.util.BlockVector;
|
import org.bukkit.util.BlockVector;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import mortar.bukkit.plugin.Controller;
|
||||||
import mortar.compute.math.M;
|
import mortar.compute.math.M;
|
||||||
import mortar.util.text.C;
|
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
|
||||||
import ninja.bytecode.iris.generator.genobject.GenObject;
|
import ninja.bytecode.iris.generator.genobject.GenObject;
|
||||||
import ninja.bytecode.iris.generator.genobject.GenObjectGroup;
|
|
||||||
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
|
||||||
import ninja.bytecode.iris.pack.IrisBiome;
|
|
||||||
import ninja.bytecode.iris.util.Cuboid;
|
import ninja.bytecode.iris.util.Cuboid;
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.iris.util.MB;
|
import ninja.bytecode.iris.util.MB;
|
||||||
import ninja.bytecode.iris.util.ParticleEffect;
|
import ninja.bytecode.iris.util.ParticleEffect;
|
||||||
import ninja.bytecode.iris.util.ParticleRedstone;
|
import ninja.bytecode.iris.util.ParticleRedstone;
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.collections.KMap;
|
|
||||||
import ninja.bytecode.shuriken.format.Form;
|
|
||||||
|
|
||||||
public class WandController implements IrisController
|
public class WandController extends Controller
|
||||||
{
|
{
|
||||||
private KMap<String, GenObject> goc;
|
|
||||||
private KMap<String, GenObjectGroup> gog;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void start()
|
||||||
{
|
{
|
||||||
goc = new KMap<>();
|
|
||||||
gog = new KMap<>();
|
|
||||||
// TODO: Optimize
|
// TODO: Optimize
|
||||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () ->
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(Iris.instance, () ->
|
||||||
{
|
{
|
||||||
@ -55,11 +43,17 @@ public class WandController implements IrisController
|
|||||||
{
|
{
|
||||||
tick(i);
|
tick(i);
|
||||||
}
|
}
|
||||||
}, 0, 5);
|
}, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop()
|
public void stop()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void tick()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -71,11 +65,6 @@ public class WandController implements IrisController
|
|||||||
{
|
{
|
||||||
if(isWand(p.getInventory().getItemInMainHand()))
|
if(isWand(p.getInventory().getItemInMainHand()))
|
||||||
{
|
{
|
||||||
if(Iris.settings.performance.debugMode && p.getWorld().getGenerator() instanceof IrisGenerator)
|
|
||||||
{
|
|
||||||
tickHighlight(p, (IrisGenerator) p.getWorld().getGenerator());
|
|
||||||
}
|
|
||||||
|
|
||||||
Location[] d = getCuboid(p.getInventory().getItemInMainHand());
|
Location[] d = getCuboid(p.getInventory().getItemInMainHand());
|
||||||
draw(d, p);
|
draw(d, p);
|
||||||
}
|
}
|
||||||
@ -87,7 +76,7 @@ public class WandController implements IrisController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void draw(Location[] d, Player p)
|
public void draw(Location[] d, Player p)
|
||||||
{
|
{
|
||||||
ParticleEffect.CRIT_MAGIC.display(0.1f, 1, d[0].clone().add(0.5, 0.5, 0.5).clone().add(Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65)), p);
|
ParticleEffect.CRIT_MAGIC.display(0.1f, 1, d[0].clone().add(0.5, 0.5, 0.5).clone().add(Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65)), p);
|
||||||
ParticleEffect.CRIT.display(0.1f, 1, d[1].clone().add(0.5, 0.5, 0.5).clone().add(Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65)), p);
|
ParticleEffect.CRIT.display(0.1f, 1, d[1].clone().add(0.5, 0.5, 0.5).clone().add(Vector.getRandom().subtract(Vector.getRandom()).normalize().clone().multiply(0.65)), p);
|
||||||
@ -168,103 +157,6 @@ public class WandController implements IrisController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void tickHighlight(Player p, IrisGenerator generator)
|
|
||||||
{
|
|
||||||
Location l = p.getTargetBlock(null, 32).getLocation();
|
|
||||||
PlacedObject po = generator.nearest(l, 12);
|
|
||||||
|
|
||||||
if(po != null)
|
|
||||||
{
|
|
||||||
if(!goc.containsKey(po.getF()))
|
|
||||||
{
|
|
||||||
String root = po.getF().split("\\Q:\\E")[0];
|
|
||||||
String n = po.getF().split("\\Q:\\E")[1];
|
|
||||||
GenObjectGroup gg = generator.getDimension().getObjectGroup(root);
|
|
||||||
gog.put(root, gg);
|
|
||||||
|
|
||||||
for(GenObject i : gg.getSchematics())
|
|
||||||
{
|
|
||||||
if(i.getName().equals(n))
|
|
||||||
{
|
|
||||||
goc.put(po.getF(), i);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!goc.containsKey(po.getF()))
|
|
||||||
{
|
|
||||||
goc.put(po.getF(), new GenObject(0, 0, 0));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GenObjectGroup ggg = gog.get(po.getF().split("\\Q:\\E")[0]);
|
|
||||||
GenObject g = goc.get(po.getF());
|
|
||||||
|
|
||||||
if(g != null)
|
|
||||||
{
|
|
||||||
Location point = new Location(l.getWorld(), po.getX(), po.getY(), po.getZ());
|
|
||||||
IrisBiome biome = generator.getBiome((int) generator.getOffsetX(po.getX(), po.getZ()), (int) generator.getOffsetZ(po.getX(), po.getZ()));
|
|
||||||
String gg = po.getF().split("\\Q:\\E")[0];
|
|
||||||
|
|
||||||
for(int j = 0; j < 10; j++)
|
|
||||||
{
|
|
||||||
p.sendMessage(" ");
|
|
||||||
}
|
|
||||||
|
|
||||||
p.sendMessage(C.DARK_GREEN + C.BOLD.toString() + gg + C.GRAY + "/" + C.RESET + C.ITALIC + C.GRAY + g.getName() + C.RESET + C.WHITE + " (1 of " + Form.f(generator.getDimension().getObjectGroup(gg).size()) + " variants)");
|
|
||||||
|
|
||||||
if(biome.getSchematicGroups().containsKey(gg))
|
|
||||||
{
|
|
||||||
String f = "";
|
|
||||||
double percent = biome.getSchematicGroups().get(gg);
|
|
||||||
|
|
||||||
if(percent > 1D)
|
|
||||||
{
|
|
||||||
f = (int) percent + " + " + Form.pc(percent - (int) percent, percent - (int) percent >= 0.01 ? 0 : 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
f = Form.pc(percent, percent >= 0.01 ? 0 : 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
p.sendMessage(C.GOLD + "Spawn Chance in " + C.YELLOW + biome.getName() + C.RESET + ": " + C.BOLD + C.WHITE + f);
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
int a = 0;
|
|
||||||
int b = 0;
|
|
||||||
double c = 0;
|
|
||||||
|
|
||||||
for(GenObject i : ggg.getSchematics())
|
|
||||||
{
|
|
||||||
a += i.getSuccesses();
|
|
||||||
b += i.getPlaces();
|
|
||||||
}
|
|
||||||
|
|
||||||
c = ((double) a / (double) b);
|
|
||||||
p.sendMessage(C.GRAY + "Grp: " + C.DARK_AQUA + Form.f(a) + C.GRAY + " of " + C.AQUA + Form.f(b) + C.GRAY + " placements (" + C.DARK_AQUA + Form.pc(c, 0) + C.GRAY + ")");
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(Throwable e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
p.sendMessage(C.GRAY + "Var: " + C.DARK_AQUA + Form.f(g.getSuccesses()) + C.GRAY + " of " + C.AQUA + Form.f(g.getPlaces()) + C.GRAY + " placements (" + C.DARK_AQUA + Form.pc(g.getSuccess(), 0) + C.GRAY + ")");
|
|
||||||
|
|
||||||
for(String i : ggg.getFlags())
|
|
||||||
{
|
|
||||||
p.sendMessage(C.GRAY + "- " + C.DARK_PURPLE + i);
|
|
||||||
}
|
|
||||||
|
|
||||||
draw(new Location[] {point.clone().add(g.getW() / 2, g.getH() / 2, g.getD() / 2), point.clone().subtract(g.getW() / 2, g.getH() / 2, g.getD() / 2)
|
|
||||||
}, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void on(PlayerInteractEvent e)
|
public void on(PlayerInteractEvent e)
|
||||||
{
|
{
|
||||||
@ -383,12 +275,6 @@ public class WandController implements IrisController
|
|||||||
return createWand(left ? a : other, left ? other : a);
|
return createWand(left ? a : other, left ? other : a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
|
||||||
{
|
|
||||||
goc.clear();
|
|
||||||
gog.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ItemStack createWand(Location a, Location b)
|
public static ItemStack createWand(Location a, Location b)
|
||||||
{
|
{
|
||||||
ItemStack is = new ItemStack(Material.BLAZE_ROD);
|
ItemStack is = new ItemStack(Material.BLAZE_ROD);
|
||||||
@ -403,6 +289,12 @@ public class WandController implements IrisController
|
|||||||
return is;
|
return is;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean isWand(Player p)
|
||||||
|
{
|
||||||
|
ItemStack is = p.getInventory().getItemInMainHand();
|
||||||
|
return !(is == null || !isWand(is));
|
||||||
|
}
|
||||||
|
|
||||||
public static Location[] getCuboid(ItemStack is)
|
public static Location[] getCuboid(ItemStack is)
|
||||||
{
|
{
|
||||||
ItemMeta im = is.getItemMeta();
|
ItemMeta im = is.getItemMeta();
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
package ninja.bytecode.iris.controller;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.World;
|
|
||||||
import org.bukkit.WorldCreator;
|
|
||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
|
||||||
import ninja.bytecode.iris.generator.IrisGenerator;
|
|
||||||
import ninja.bytecode.iris.pack.CompiledDimension;
|
|
||||||
import ninja.bytecode.iris.util.IrisController;
|
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
|
||||||
import ninja.bytecode.shuriken.io.IO;
|
|
||||||
|
|
||||||
public class WorldController implements IrisController
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isChunkGenerated(World w, int x, int z)
|
|
||||||
{
|
|
||||||
return w.loadChunk(x, z, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public World createIrisWorld(CompiledDimension dimension, long seed, boolean temp)
|
|
||||||
{
|
|
||||||
if(dimension == null)
|
|
||||||
{
|
|
||||||
dimension = Iris.getController(PackController.class).getDimension("overworld");
|
|
||||||
}
|
|
||||||
|
|
||||||
//@builder
|
|
||||||
World ww = Bukkit.createWorld(new WorldCreator("iris-worlds/" + UUID.randomUUID().toString())
|
|
||||||
.generator(new IrisGenerator(dimension))
|
|
||||||
.environment(dimension.getEnvironment())
|
|
||||||
.seed(seed));
|
|
||||||
//@done
|
|
||||||
ww.setSpawnFlags(false, false);
|
|
||||||
ww.setAutoSave(false);
|
|
||||||
ww.setKeepSpawnInMemory(false);
|
|
||||||
ww.setSpawnLocation(0, 256, 0);
|
|
||||||
|
|
||||||
if(temp)
|
|
||||||
{
|
|
||||||
File folder = ww.getWorldFolder();
|
|
||||||
J.attempt(() -> new File(ww.getWorldFolder(), ".garbage").createNewFile());
|
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
IO.delete(folder);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FileUtils.forceDelete(folder);
|
|
||||||
System.out.println("Deleted Debug World: " + folder.getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
catch(IOException e)
|
|
||||||
{
|
|
||||||
System.out.println("FAILED TO Delete Debug World: " + folder.getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return ww;
|
|
||||||
}
|
|
||||||
}
|
|
@ -13,7 +13,6 @@ import org.bukkit.util.NumberConversions;
|
|||||||
import mortar.util.text.C;
|
import mortar.util.text.C;
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.IrisMetrics;
|
import ninja.bytecode.iris.IrisMetrics;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
|
||||||
import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
||||||
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
import ninja.bytecode.iris.generator.genobject.GenObjectDecorator;
|
||||||
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
import ninja.bytecode.iris.generator.genobject.PlacedObject;
|
||||||
@ -63,8 +62,6 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
|||||||
private CNG scatter;
|
private CNG scatter;
|
||||||
private CNG beach;
|
private CNG beach;
|
||||||
private CNG swirl;
|
private CNG swirl;
|
||||||
private MB ICE = new MB(Material.ICE);
|
|
||||||
private MB PACKED_ICE = new MB(Material.PACKED_ICE);
|
|
||||||
private MB BEDROCK = new MB(Material.BEDROCK);
|
private MB BEDROCK = new MB(Material.BEDROCK);
|
||||||
private GenObjectDecorator god;
|
private GenObjectDecorator god;
|
||||||
private GenLayerLayeredNoise glLNoise;
|
private GenLayerLayeredNoise glLNoise;
|
||||||
@ -78,7 +75,7 @@ public class IrisGenerator extends ParallaxWorldGenerator
|
|||||||
|
|
||||||
public IrisGenerator()
|
public IrisGenerator()
|
||||||
{
|
{
|
||||||
this(Iris.getController(PackController.class).getDimension("overworld"));
|
this(Iris.pack().getDimension("overworld"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void hitObject()
|
public void hitObject()
|
||||||
|
@ -8,7 +8,6 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
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.PackController;
|
|
||||||
import ninja.bytecode.iris.util.Direction;
|
import ninja.bytecode.iris.util.Direction;
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.format.Form;
|
import ninja.bytecode.shuriken.format.Form;
|
||||||
@ -171,7 +170,7 @@ public class GenObjectGroup
|
|||||||
|
|
||||||
public static GenObjectGroup load(String string)
|
public static GenObjectGroup load(String string)
|
||||||
{
|
{
|
||||||
File folder = Iris.getController(PackController.class).loadFolder(string);
|
File folder = Iris.pack().loadFolder(string);
|
||||||
|
|
||||||
if(folder != null)
|
if(folder != null)
|
||||||
{
|
{
|
||||||
|
@ -9,12 +9,9 @@ import org.bukkit.block.Biome;
|
|||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.ExecutionController;
|
|
||||||
import ninja.bytecode.iris.controller.TimingsController;
|
|
||||||
import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
import ninja.bytecode.iris.generator.atomics.AtomicChunkData;
|
||||||
import ninja.bytecode.iris.util.ChunkPlan;
|
import ninja.bytecode.iris.util.ChunkPlan;
|
||||||
import ninja.bytecode.iris.util.ChunkSpliceListener;
|
import ninja.bytecode.iris.util.ChunkSpliceListener;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor;
|
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskGroup;
|
||||||
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskResult;
|
import ninja.bytecode.shuriken.execution.TaskExecutor.TaskResult;
|
||||||
import ninja.bytecode.shuriken.math.RollingSequence;
|
import ninja.bytecode.shuriken.math.RollingSequence;
|
||||||
@ -32,8 +29,6 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
int cg = 0;
|
int cg = 0;
|
||||||
private RollingSequence rs = new RollingSequence(512);
|
private RollingSequence rs = new RollingSequence(512);
|
||||||
private World world;
|
private World world;
|
||||||
private TaskExecutor genPool;
|
|
||||||
private TaskExecutor genPar;
|
|
||||||
private ChunkSpliceListener splicer;
|
private ChunkSpliceListener splicer;
|
||||||
|
|
||||||
public void setSplicer(ChunkSpliceListener splicer)
|
public void setSplicer(ChunkSpliceListener splicer)
|
||||||
@ -53,22 +48,12 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
|
|
||||||
public TaskGroup startParallaxWork()
|
public TaskGroup startParallaxWork()
|
||||||
{
|
{
|
||||||
if(genPar == null)
|
return Iris.exec().getExecutor(world, "Parallax").startWork();
|
||||||
{
|
|
||||||
genPar = Iris.getController(ExecutionController.class).getExecutor(world, "Parallax");
|
|
||||||
}
|
|
||||||
|
|
||||||
return genPar.startWork();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TaskGroup startWork()
|
public TaskGroup startWork()
|
||||||
{
|
{
|
||||||
if(genPool == null)
|
return Iris.exec().getExecutor(world, "Generator").startWork();
|
||||||
{
|
|
||||||
genPool = Iris.getController(ExecutionController.class).getExecutor(world, "Generator");
|
|
||||||
}
|
|
||||||
|
|
||||||
return genPool.startWork();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome)
|
||||||
@ -88,8 +73,6 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Iris.getController(TimingsController.class).started("terrain");
|
|
||||||
|
|
||||||
this.world = world;
|
this.world = world;
|
||||||
|
|
||||||
if(!ready)
|
if(!ready)
|
||||||
@ -127,7 +110,6 @@ public abstract class ParallelChunkGenerator extends ChunkGenerator
|
|||||||
postChunk(world, x, z, random, data, plan.get());
|
postChunk(world, x, z, random, data, plan.get());
|
||||||
rs.put(r.timeElapsed);
|
rs.put(r.timeElapsed);
|
||||||
cg++;
|
cg++;
|
||||||
Iris.getController(TimingsController.class).stopped("terrain");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
catch(Throwable e)
|
catch(Throwable e)
|
||||||
|
@ -8,7 +8,6 @@ import org.bukkit.block.Biome;
|
|||||||
|
|
||||||
import mortar.util.text.C;
|
import mortar.util.text.C;
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
|
||||||
import ninja.bytecode.iris.generator.layer.BiomeNoiseGenerator;
|
import ninja.bytecode.iris.generator.layer.BiomeNoiseGenerator;
|
||||||
import ninja.bytecode.iris.util.MB;
|
import ninja.bytecode.iris.util.MB;
|
||||||
import ninja.bytecode.iris.util.ObjectMode;
|
import ninja.bytecode.iris.util.ObjectMode;
|
||||||
@ -286,7 +285,7 @@ public class IrisBiome
|
|||||||
{
|
{
|
||||||
for(String i : schematicGroups.k())
|
for(String i : schematicGroups.k())
|
||||||
{
|
{
|
||||||
Iris.getController(PackController.class).loadSchematicGroup(i);
|
Iris.pack().loadSchematicGroup(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import java.io.IOException;
|
|||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
import ninja.bytecode.shuriken.execution.J;
|
||||||
import ninja.bytecode.shuriken.json.JSONArray;
|
import ninja.bytecode.shuriken.json.JSONArray;
|
||||||
@ -69,8 +68,8 @@ public class IrisDimension
|
|||||||
{
|
{
|
||||||
int ii = i;
|
int ii = i;
|
||||||
|
|
||||||
IrisBiome bb = Iris.getController(PackController.class).loadBiome(a.getString(ii));
|
IrisBiome bb = Iris.pack().loadBiome(a.getString(ii));
|
||||||
Iris.getController(PackController.class).registerBiome(a.getString(ii), bb);
|
Iris.pack().registerBiome(a.getString(ii), bb);
|
||||||
b.add(bb);
|
b.add(bb);
|
||||||
}
|
}
|
||||||
return b;
|
return b;
|
||||||
|
@ -3,7 +3,6 @@ package ninja.bytecode.iris.pack;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
import ninja.bytecode.shuriken.execution.J;
|
||||||
import ninja.bytecode.shuriken.json.JSONArray;
|
import ninja.bytecode.shuriken.json.JSONArray;
|
||||||
@ -74,14 +73,14 @@ public class IrisPack
|
|||||||
{
|
{
|
||||||
for(String i : dimensions)
|
for(String i : dimensions)
|
||||||
{
|
{
|
||||||
IrisDimension d = Iris.getController(PackController.class).loadDimension(i);
|
IrisDimension d = Iris.pack().loadDimension(i);
|
||||||
Iris.getController(PackController.class).registerDimension(i, d);
|
Iris.pack().registerDimension(i, d);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadBiome(String s) throws JSONException, IOException
|
public void loadBiome(String s) throws JSONException, IOException
|
||||||
{
|
{
|
||||||
IrisBiome b = Iris.getController(PackController.class).loadBiome(s);
|
IrisBiome b = Iris.pack().loadBiome(s);
|
||||||
Iris.getController(PackController.class).registerBiome(s, b);
|
Iris.pack().registerBiome(s, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ package ninja.bytecode.iris.pack;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import ninja.bytecode.iris.Iris;
|
import ninja.bytecode.iris.Iris;
|
||||||
import ninja.bytecode.iris.controller.PackController;
|
|
||||||
import ninja.bytecode.shuriken.collections.KList;
|
import ninja.bytecode.shuriken.collections.KList;
|
||||||
import ninja.bytecode.shuriken.execution.J;
|
import ninja.bytecode.shuriken.execution.J;
|
||||||
import ninja.bytecode.shuriken.json.JSONObject;
|
import ninja.bytecode.shuriken.json.JSONObject;
|
||||||
@ -33,13 +32,13 @@ public class IrisRegion
|
|||||||
{
|
{
|
||||||
J.attempt(() ->
|
J.attempt(() ->
|
||||||
{
|
{
|
||||||
JSONObject o = Iris.getController(PackController.class).loadJSON("pack/regions/" + name + ".json");
|
JSONObject o = Iris.pack().loadJSON("pack/regions/" + name + ".json");
|
||||||
J.attempt(() -> name = o.getString("name"));
|
J.attempt(() -> name = o.getString("name"));
|
||||||
J.attempt(() -> ocean = Iris.getController(PackController.class).getBiomeById(o.getString("ocean")));
|
J.attempt(() -> ocean = Iris.pack().getBiomeById(o.getString("ocean")));
|
||||||
J.attempt(() -> beach = Iris.getController(PackController.class).getBiomeById(o.getString("beach")));
|
J.attempt(() -> beach = Iris.pack().getBiomeById(o.getString("beach")));
|
||||||
J.attempt(() -> lake = Iris.getController(PackController.class).getBiomeById(o.getString("lake")));
|
J.attempt(() -> lake = Iris.pack().getBiomeById(o.getString("lake")));
|
||||||
J.attempt(() -> lakeBeach = Iris.getController(PackController.class).getBiomeById(o.getString("shore")));
|
J.attempt(() -> lakeBeach = Iris.pack().getBiomeById(o.getString("shore")));
|
||||||
J.attempt(() -> channel = Iris.getController(PackController.class).getBiomeById(o.getString("channel")));
|
J.attempt(() -> channel = Iris.pack().getBiomeById(o.getString("channel")));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
name: ${project.name}
|
name: ${project.name}
|
||||||
version: ${project.version}
|
version: ${project.version}
|
||||||
main: ninja.bytecode.iris.Iris
|
main: ninja.bytecode.iris.Iris
|
||||||
commands:
|
load: STARTUP
|
||||||
iris:
|
|
||||||
ish:
|
|
||||||
depend: [Mortar]
|
depend: [Mortar]
|
Loading…
x
Reference in New Issue
Block a user