Code Cleanup, the second.

This commit is contained in:
Vatuu 2022-10-12 07:13:03 +02:00
parent f6fbcade17
commit 211b15332d
No known key found for this signature in database
GPG Key ID: C6F07B79B2ED9150
10 changed files with 110 additions and 113 deletions

View File

@ -33,7 +33,7 @@ import com.volmit.iris.util.format.C;
public class CommandFind implements DecreeExecutor { public class CommandFind implements DecreeExecutor {
@Decree(description = "Find a biome") @Decree(description = "Find a biome")
public void biome( public void biome(
@Param(description = "The biome to look for") @Param(description = "The biome to look for")
IrisBiome biome IrisBiome biome
) { ) {
Engine e = engine(); Engine e = engine();
@ -48,7 +48,7 @@ public class CommandFind implements DecreeExecutor {
@Decree(description = "Find a region") @Decree(description = "Find a region")
public void region( public void region(
@Param(description = "The region to look for") @Param(description = "The region to look for")
IrisRegion region IrisRegion region
) { ) {
Engine e = engine(); Engine e = engine();
@ -63,7 +63,7 @@ public class CommandFind implements DecreeExecutor {
@Decree(description = "Find a structure") @Decree(description = "Find a structure")
public void structure( public void structure(
@Param(description = "The structure to look for") @Param(description = "The structure to look for")
IrisJigsawStructure structure IrisJigsawStructure structure
) { ) {
Engine e = engine(); Engine e = engine();
@ -78,7 +78,7 @@ public class CommandFind implements DecreeExecutor {
@Decree(description = "Find an object") @Decree(description = "Find an object")
public void object( public void object(
@Param(description = "The object to look for", customHandler = ObjectHandler.class) @Param(description = "The object to look for", customHandler = ObjectHandler.class)
String object String object
) { ) {
Engine e = engine(); Engine e = engine();

View File

@ -60,11 +60,11 @@ public class CommandIris implements DecreeExecutor {
@Decree(description = "Create a new world", aliases = {"+", "c"}) @Decree(description = "Create a new world", aliases = {"+", "c"})
public void create( public void create(
@Param(aliases = "world-name", description = "The name of the world to create") @Param(aliases = "world-name", description = "The name of the world to create")
String name, String name,
@Param(aliases = "dimension", description = "The dimension type to create the world with", defaultValue = "default") @Param(aliases = "dimension", description = "The dimension type to create the world with", defaultValue = "default")
IrisDimension type, IrisDimension type,
@Param(description = "The seed to generate the world with", defaultValue = "1337") @Param(description = "The seed to generate the world with", defaultValue = "1337")
long seed long seed
) { ) {
if(name.equals("iris")) { if(name.equals("iris")) {
@ -80,12 +80,12 @@ public class CommandIris implements DecreeExecutor {
try { try {
IrisToolbelt.createWorld() IrisToolbelt.createWorld()
.dimension(type.getLoadKey()) .dimension(type.getLoadKey())
.name(name) .name(name)
.seed(seed) .seed(seed)
.sender(sender()) .sender(sender())
.studio(false) .studio(false)
.create(); .create();
} catch(Throwable e) { } catch(Throwable e) {
sender().sendMessage(C.RED + "Exception raised during creation. See the console for more details."); sender().sendMessage(C.RED + "Exception raised during creation. See the console for more details.");
Iris.error("Exception raised during world creation: " + e.getMessage()); Iris.error("Exception raised during world creation: " + e.getMessage());
@ -103,24 +103,24 @@ public class CommandIris implements DecreeExecutor {
@Param(description = "Whether to also remove the folder (if set to false, just does not load the world)", defaultValue = "true") @Param(description = "Whether to also remove the folder (if set to false, just does not load the world)", defaultValue = "true")
boolean delete boolean delete
) { ) {
if (!IrisToolbelt.isIrisWorld(world)) { if(!IrisToolbelt.isIrisWorld(world)) {
sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", Bukkit.getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList())); sender().sendMessage(C.RED + "This is not an Iris world. Iris worlds: " + String.join(", ", Bukkit.getServer().getWorlds().stream().filter(IrisToolbelt::isIrisWorld).map(World::getName).toList()));
return; return;
} }
sender().sendMessage(C.GREEN + "Removing world: " + world.getName()); sender().sendMessage(C.GREEN + "Removing world: " + world.getName());
try { try {
if (IrisToolbelt.removeWorld(world)) { if(IrisToolbelt.removeWorld(world)) {
sender().sendMessage(C.GREEN + "Successfully removed " + world.getName() + " from bukkit.yml"); sender().sendMessage(C.GREEN + "Successfully removed " + world.getName() + " from bukkit.yml");
} else { } else {
sender().sendMessage(C.YELLOW + "Looks like the world was already removed from bukkit.yml"); sender().sendMessage(C.YELLOW + "Looks like the world was already removed from bukkit.yml");
} }
} catch (IOException e) { } catch(IOException e) {
sender().sendMessage(C.RED + "Failed to save bukkit.yml because of " + e.getMessage()); sender().sendMessage(C.RED + "Failed to save bukkit.yml because of " + e.getMessage());
e.printStackTrace(); e.printStackTrace();
} }
IrisToolbelt.evacuate(world, "Deleting world"); IrisToolbelt.evacuate(world, "Deleting world");
Bukkit.unloadWorld(world, false); Bukkit.unloadWorld(world, false);
if (delete && world.getWorldFolder().delete()) { if(delete && world.getWorldFolder().delete()) {
sender().sendMessage(C.GREEN + "Successfully removed world folder"); sender().sendMessage(C.GREEN + "Successfully removed world folder");
} else { } else {
sender().sendMessage(C.RED + "Failed to remove world folder"); sender().sendMessage(C.RED + "Failed to remove world folder");
@ -146,11 +146,11 @@ public class CommandIris implements DecreeExecutor {
@Decree(description = "Set aura spins") @Decree(description = "Set aura spins")
public void aura( public void aura(
@Param(description = "The h color value", defaultValue = "-20") @Param(description = "The h color value", defaultValue = "-20")
int h, int h,
@Param(description = "The s color value", defaultValue = "7") @Param(description = "The s color value", defaultValue = "7")
int s, int s,
@Param(description = "The b color value", defaultValue = "8") @Param(description = "The b color value", defaultValue = "8")
int b int b
) { ) {
IrisSettings.get().getGeneral().setSpinh(h); IrisSettings.get().getGeneral().setSpinh(h);
@ -162,11 +162,11 @@ public class CommandIris implements DecreeExecutor {
@Decree(description = "Bitwise calculations") @Decree(description = "Bitwise calculations")
public void bitwise( public void bitwise(
@Param(description = "The first value to run calculations on") @Param(description = "The first value to run calculations on")
int value1, int value1,
@Param(description = "The operator: | & ^ ≺≺ ≻≻ ") @Param(description = "The operator: | & ^ ≺≺ ≻≻ ")
String operator, String operator,
@Param(description = "The second value to run calculations on") @Param(description = "The second value to run calculations on")
int value2 int value2
) { ) {
Integer v = null; Integer v = null;
@ -187,7 +187,7 @@ public class CommandIris implements DecreeExecutor {
@Decree(description = "Toggle debug") @Decree(description = "Toggle debug")
public void debug( public void debug(
@Param(name = "on", description = "Whether or not debug should be on", defaultValue = "other") @Param(name = "on", description = "Whether or not debug should be on", defaultValue = "other")
Boolean on Boolean on
) { ) {
boolean to = on == null ? !IrisSettings.get().getGeneral().isDebug() : on; boolean to = on == null ? !IrisSettings.get().getGeneral().isDebug() : on;
@ -198,13 +198,13 @@ public class CommandIris implements DecreeExecutor {
@Decree(description = "Download a project.", aliases = "dl") @Decree(description = "Download a project.", aliases = "dl")
public void download( public void download(
@Param(name = "pack", description = "The pack to download", defaultValue = "overworld", aliases = "project") @Param(name = "pack", description = "The pack to download", defaultValue = "overworld", aliases = "project")
String pack, String pack,
@Param(name = "branch", description = "The branch to download from", defaultValue = "main") @Param(name = "branch", description = "The branch to download from", defaultValue = "main")
String branch, String branch,
@Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when editing)", defaultValue = "false") @Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when editing)", defaultValue = "false")
boolean trim, boolean trim,
@Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false") @Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false")
boolean overwrite boolean overwrite
) { ) {
sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : "") + (overwrite ? " overwriting" : "")); sender().sendMessage(C.GREEN + "Downloading pack: " + pack + "/" + branch + (trim ? " trimmed" : "") + (overwrite ? " overwriting" : ""));
@ -235,7 +235,7 @@ public class CommandIris implements DecreeExecutor {
@Decree(name = "regen", description = "Regenerate nearby chunks.", aliases = "rg", sync = true, origin = DecreeOrigin.PLAYER) @Decree(name = "regen", description = "Regenerate nearby chunks.", aliases = "rg", sync = true, origin = DecreeOrigin.PLAYER)
public void regen( public void regen(
@Param(name = "radius", description = "The radius of nearby cunks", defaultValue = "5") @Param(name = "radius", description = "The radius of nearby cunks", defaultValue = "5")
int radius int radius
) { ) {
if(IrisToolbelt.isIrisWorld(player().getWorld())) { if(IrisToolbelt.isIrisWorld(player().getWorld())) {
@ -306,26 +306,26 @@ public class CommandIris implements DecreeExecutor {
@Decree(description = "Update the pack of a world (UNSAFE!)", name = "^world", aliases = "update-world") @Decree(description = "Update the pack of a world (UNSAFE!)", name = "^world", aliases = "update-world")
public void updateWorld( public void updateWorld(
@Param(description = "The world to update", contextual = true) @Param(description = "The world to update", contextual = true)
World world, World world,
@Param(description = "The pack to install into the world", contextual = true, aliases = "dimension") @Param(description = "The pack to install into the world", contextual = true, aliases = "dimension")
IrisDimension pack, IrisDimension pack,
@Param(description = "Make sure to make a backup & read the warnings first!", defaultValue = "false", aliases = "c") @Param(description = "Make sure to make a backup & read the warnings first!", defaultValue = "false", aliases = "c")
boolean confirm, boolean confirm,
@Param(description = "Should Iris download the pack again for you", defaultValue = "false", name = "fresh-download", aliases = {"fresh", "new"}) @Param(description = "Should Iris download the pack again for you", defaultValue = "false", name = "fresh-download", aliases = {"fresh", "new"})
boolean freshDownload boolean freshDownload
) { ) {
if(!confirm) { if(!confirm) {
sender().sendMessage(new String[] { sender().sendMessage(new String[]{
C.RED + "You should always make a backup before using this", C.RED + "You should always make a backup before using this",
C.YELLOW + "Issues caused by this can be, but are not limited to:", C.YELLOW + "Issues caused by this can be, but are not limited to:",
C.YELLOW + " - Broken chunks (cut-offs) between old and new chunks (before & after the update)", C.YELLOW + " - Broken chunks (cut-offs) between old and new chunks (before & after the update)",
C.YELLOW + " - Regenerated chunks that do not fit in with the old chunks", C.YELLOW + " - Regenerated chunks that do not fit in with the old chunks",
C.YELLOW + " - Structures not spawning again when regenerating", C.YELLOW + " - Structures not spawning again when regenerating",
C.YELLOW + " - Caves not lining up", C.YELLOW + " - Caves not lining up",
C.YELLOW + " - Terrain layers not lining up", C.YELLOW + " - Terrain layers not lining up",
C.RED + "Now that you are aware of the risks, and have made a back-up:", C.RED + "Now that you are aware of the risks, and have made a back-up:",
C.RED + "/iris ^world <world> <pack> confirm=true" C.RED + "/iris ^world <world> <pack> confirm=true"
}); });
return; return;
} }

View File

@ -42,7 +42,7 @@ import java.io.File;
public class CommandJigsaw implements DecreeExecutor { public class CommandJigsaw implements DecreeExecutor {
@Decree(description = "Edit a jigsaw piece") @Decree(description = "Edit a jigsaw piece")
public void edit( public void edit(
@Param(description = "The jigsaw piece to edit") @Param(description = "The jigsaw piece to edit")
IrisJigsawPiece piece IrisJigsawPiece piece
) { ) {
File dest = piece.getLoadFile(); File dest = piece.getLoadFile();
@ -51,7 +51,7 @@ public class CommandJigsaw implements DecreeExecutor {
@Decree(description = "Place a jigsaw structure") @Decree(description = "Place a jigsaw structure")
public void place( public void place(
@Param(description = "The jigsaw structure to place") @Param(description = "The jigsaw structure to place")
IrisJigsawStructure structure IrisJigsawStructure structure
) { ) {
PrecisionStopwatch p = PrecisionStopwatch.start(); PrecisionStopwatch p = PrecisionStopwatch.start();
@ -62,11 +62,11 @@ public class CommandJigsaw implements DecreeExecutor {
@Decree(description = "Create a jigsaw piece") @Decree(description = "Create a jigsaw piece")
public void create( public void create(
@Param(description = "The name of the jigsaw piece") @Param(description = "The name of the jigsaw piece")
String piece, String piece,
@Param(description = "The project to add the jigsaw piece to") @Param(description = "The project to add the jigsaw piece to")
String project, String project,
@Param(description = "The object to use for this piece", customHandler = ObjectHandler.class) @Param(description = "The object to use for this piece", customHandler = ObjectHandler.class)
String object String object
) { ) {
IrisObject o = IrisData.loadAnyObject(object); IrisObject o = IrisData.loadAnyObject(object);

View File

@ -54,7 +54,7 @@ import java.util.stream.Collectors;
public class CommandObject implements DecreeExecutor { public class CommandObject implements DecreeExecutor {
private static final Set<Material> skipBlocks = Set.of(Material.GRASS, Material.SNOW, Material.VINE, Material.TORCH, Material.DEAD_BUSH, private static final Set<Material> skipBlocks = Set.of(Material.GRASS, Material.SNOW, Material.VINE, Material.TORCH, Material.DEAD_BUSH,
Material.POPPY, Material.DANDELION); Material.POPPY, Material.DANDELION);
public static IObjectPlacer createPlacer(World world, Map<Block, BlockData> futureBlockChanges) { public static IObjectPlacer createPlacer(World world, Map<Block, BlockData> futureBlockChanges) {
@ -132,7 +132,7 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Check the composition of an object") @Decree(description = "Check the composition of an object")
public void analyze( public void analyze(
@Param(description = "The object to analyze", customHandler = ObjectHandler.class) @Param(description = "The object to analyze", customHandler = ObjectHandler.class)
String object String object
) { ) {
IrisObject o = IrisData.loadAnyObject(object); IrisObject o = IrisData.loadAnyObject(object);
@ -167,7 +167,7 @@ public class CommandObject implements DecreeExecutor {
} }
List<Material> sortedMatsList = amounts.keySet().stream().map(BlockData::getMaterial) List<Material> sortedMatsList = amounts.keySet().stream().map(BlockData::getMaterial)
.sorted().collect(Collectors.toList()); .sorted().collect(Collectors.toList());
Set<Material> sortedMats = new TreeSet<>(Comparator.comparingInt(materials::get).reversed()); Set<Material> sortedMats = new TreeSet<>(Comparator.comparingInt(materials::get).reversed());
sortedMats.addAll(sortedMatsList); sortedMats.addAll(sortedMatsList);
sender().sendMessage("== Blocks in object =="); sender().sendMessage("== Blocks in object ==");
@ -183,8 +183,8 @@ public class CommandObject implements DecreeExecutor {
String string = " - " + mat.toString() + "*" + amount; String string = " - " + mat.toString() + "*" + amount;
if(data.getAsString(true).contains("[")) { if(data.getAsString(true).contains("[")) {
string = string + " --> [" + data.getAsString(true).split("\\[")[1] string = string + " --> [" + data.getAsString(true).split("\\[")[1]
.replaceAll("true", ChatColor.GREEN + "true" + ChatColor.GRAY) .replaceAll("true", ChatColor.GREEN + "true" + ChatColor.GRAY)
.replaceAll("false", ChatColor.RED + "false" + ChatColor.GRAY) + "*" + dataAmount; .replaceAll("false", ChatColor.RED + "false" + ChatColor.GRAY) + "*" + dataAmount;
} }
sender().sendMessage(string); sender().sendMessage(string);
@ -206,7 +206,7 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Contract a selection based on your looking direction", aliases = "-") @Decree(description = "Contract a selection based on your looking direction", aliases = "-")
public void contract( public void contract(
@Param(description = "The amount to inset by", defaultValue = "1") @Param(description = "The amount to inset by", defaultValue = "1")
int amount int amount
) { ) {
if(!WandSVC.isHoldingWand(player())) { if(!WandSVC.isHoldingWand(player())) {
@ -231,7 +231,7 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Set point 1 to look", aliases = "p1") @Decree(description = "Set point 1 to look", aliases = "p1")
public void position1( public void position1(
@Param(description = "Whether to use your current position, or where you look", defaultValue = "true") @Param(description = "Whether to use your current position, or where you look", defaultValue = "true")
boolean here boolean here
) { ) {
if(!WandSVC.isHoldingWand(player())) { if(!WandSVC.isHoldingWand(player())) {
@ -254,7 +254,7 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Set point 2 to look", aliases = "p2") @Decree(description = "Set point 2 to look", aliases = "p2")
public void position2( public void position2(
@Param(description = "Whether to use your current position, or where you look", defaultValue = "true") @Param(description = "Whether to use your current position, or where you look", defaultValue = "true")
boolean here boolean here
) { ) {
if(!WandSVC.isHoldingWand(player())) { if(!WandSVC.isHoldingWand(player())) {
@ -277,13 +277,13 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Paste an object", sync = true) @Decree(description = "Paste an object", sync = true)
public void paste( public void paste(
@Param(description = "The object to paste", customHandler = ObjectHandler.class) @Param(description = "The object to paste", customHandler = ObjectHandler.class)
String object, String object,
@Param(description = "Whether or not to edit the object (need to hold wand)", defaultValue = "false") @Param(description = "Whether or not to edit the object (need to hold wand)", defaultValue = "false")
boolean edit, boolean edit,
@Param(description = "The amount of degrees to rotate by", defaultValue = "0") @Param(description = "The amount of degrees to rotate by", defaultValue = "0")
int rotate, int rotate,
@Param(description = "The factor by which to scale the object placement", defaultValue = "1") @Param(description = "The factor by which to scale the object placement", defaultValue = "1")
double scale double scale
// , // ,
// @Param(description = "The scale interpolator to use", defaultValue = "none") // @Param(description = "The scale interpolator to use", defaultValue = "none")
@ -306,8 +306,7 @@ public class CommandObject implements DecreeExecutor {
Map<Block, BlockData> futureChanges = new HashMap<>(); Map<Block, BlockData> futureChanges = new HashMap<>();
if(scale != 1) if(scale != 1) {
{
o = o.scaled(scale, IrisObjectPlacementScaleInterpolator.TRICUBIC); o = o.scaled(scale, IrisObjectPlacementScaleInterpolator.TRICUBIC);
} }
@ -317,7 +316,7 @@ public class CommandObject implements DecreeExecutor {
if(edit) { if(edit) {
ItemStack newWand = WandSVC.createWand(block.clone().subtract(o.getCenter()).add(o.getW() - 1, ItemStack newWand = WandSVC.createWand(block.clone().subtract(o.getCenter()).add(o.getW() - 1,
o.getH() + o.getCenter().clone().getY() - 1, o.getD() - 1), block.clone().subtract(o.getCenter().clone().setY(0))); o.getH() + o.getCenter().clone().getY() - 1, o.getD() - 1), block.clone().subtract(o.getCenter().clone().setY(0)));
if(WandSVC.isWand(wand)) { if(WandSVC.isWand(wand)) {
wand = newWand; wand = newWand;
player().getInventory().setItemInMainHand(wand); player().getInventory().setItemInMainHand(wand);
@ -339,11 +338,11 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Save an object") @Decree(description = "Save an object")
public void save( public void save(
@Param(description = "The dimension to store the object in", contextual = true) @Param(description = "The dimension to store the object in", contextual = true)
IrisDimension dimension, IrisDimension dimension,
@Param(description = "The file to store it in, can use / for subfolders") @Param(description = "The file to store it in, can use / for subfolders")
String name, String name,
@Param(description = "Overwrite existing object files", defaultValue = "false", aliases = "force") @Param(description = "Overwrite existing object files", defaultValue = "false", aliases = "force")
boolean overwrite boolean overwrite
) { ) {
IrisObject o = WandSVC.createSchematic(player()); IrisObject o = WandSVC.createSchematic(player());
@ -372,7 +371,7 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Shift a selection in your looking direction", aliases = "-") @Decree(description = "Shift a selection in your looking direction", aliases = "-")
public void shift( public void shift(
@Param(description = "The amount to shift by", defaultValue = "1") @Param(description = "The amount to shift by", defaultValue = "1")
int amount int amount
) { ) {
if(!WandSVC.isHoldingWand(player())) { if(!WandSVC.isHoldingWand(player())) {
@ -396,7 +395,7 @@ public class CommandObject implements DecreeExecutor {
@Decree(description = "Undo a number of pastes", aliases = "-") @Decree(description = "Undo a number of pastes", aliases = "-")
public void undo( public void undo(
@Param(description = "The amount of pastes to undo", defaultValue = "1") @Param(description = "The amount of pastes to undo", defaultValue = "1")
int amount int amount
) { ) {
ObjectSVC service = Iris.service(ObjectSVC.class); ObjectSVC service = Iris.service(ObjectSVC.class);
@ -414,8 +413,7 @@ public class CommandObject implements DecreeExecutor {
Cuboid locs = WorldEditLink.getSelection(sender().player()); Cuboid locs = WorldEditLink.getSelection(sender().player());
if(locs == null) if(locs == null) {
{
sender().sendMessage(C.RED + "You don't have a WorldEdit selection in this world."); sender().sendMessage(C.RED + "You don't have a WorldEdit selection in this world.");
return; return;
} }

View File

@ -34,11 +34,11 @@ import org.bukkit.util.Vector;
public class CommandPregen implements DecreeExecutor { public class CommandPregen implements DecreeExecutor {
@Decree(description = "Pregenerate a world") @Decree(description = "Pregenerate a world")
public void start( public void start(
@Param(description = "The radius of the pregen in blocks", aliases = "size") @Param(description = "The radius of the pregen in blocks", aliases = "size")
int radius, int radius,
@Param(description = "The world to pregen", contextual = true) @Param(description = "The world to pregen", contextual = true)
World world, World world,
@Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0") @Param(aliases = "middle", description = "The center location of the pregen. Use \"me\" for your current location", defaultValue = "0,0")
Vector center Vector center
) { ) {
try { try {
@ -49,11 +49,11 @@ public class CommandPregen implements DecreeExecutor {
radius = Math.max(radius, 1024); radius = Math.max(radius, 1024);
int w = (radius >> 9 + 1) * 2; int w = (radius >> 9 + 1) * 2;
IrisToolbelt.pregenerate(PregenTask IrisToolbelt.pregenerate(PregenTask
.builder() .builder()
.center(new Position2(center)) .center(new Position2(center))
.width(w) .width(w)
.height(w) .height(w)
.build(), world); .build(), world);
String msg = C.GREEN + "Pregen started in " + C.GOLD + world.getName() + C.GREEN + " of " + C.GOLD + (radius * 2) + C.GREEN + " by " + C.GOLD + (radius * 2) + C.GREEN + " blocks from " + C.GOLD + center.getX() + "," + center.getZ(); String msg = C.GREEN + "Pregen started in " + C.GOLD + world.getName() + C.GREEN + " of " + C.GOLD + (radius * 2) + C.GREEN + " by " + C.GOLD + (radius * 2) + C.GREEN + " blocks from " + C.GOLD + center.getX() + "," + center.getZ();
sender().sendMessage(msg); sender().sendMessage(msg);
Iris.info(msg); Iris.info(msg);

View File

@ -71,23 +71,22 @@ import java.util.function.Supplier;
@Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true) @Decree(name = "studio", aliases = {"std", "s"}, description = "Studio Commands", studio = true)
public class CommandStudio implements DecreeExecutor { public class CommandStudio implements DecreeExecutor {
private CommandFind find;
private CommandEdit edit;
public static String hrf(Duration duration) { public static String hrf(Duration duration) {
return duration.toString().substring(2).replaceAll("(\\d[HMS])(?!$)", "$1 ").toLowerCase(); return duration.toString().substring(2).replaceAll("(\\d[HMS])(?!$)", "$1 ").toLowerCase();
} }
private CommandFind find;
private CommandEdit edit;
@Decree(description = "Download a project.", aliases = "dl") @Decree(description = "Download a project.", aliases = "dl")
public void download( public void download(
@Param(name = "pack", description = "The pack to download", defaultValue = "overworld", aliases = "project") @Param(name = "pack", description = "The pack to download", defaultValue = "overworld", aliases = "project")
String pack, String pack,
@Param(name = "branch", description = "The branch to download from", defaultValue = "master") @Param(name = "branch", description = "The branch to download from", defaultValue = "master")
String branch, String branch,
@Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when editing)", defaultValue = "false") @Param(name = "trim", description = "Whether or not to download a trimmed version (do not enable when editing)", defaultValue = "false")
boolean trim, boolean trim,
@Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false") @Param(name = "overwrite", description = "Whether or not to overwrite the pack with the downloaded one", aliases = "force", defaultValue = "false")
boolean overwrite boolean overwrite
) { ) {
new CommandIris().download(pack, branch, trim, overwrite); new CommandIris().download(pack, branch, trim, overwrite);
@ -95,9 +94,9 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Open a new studio world", aliases = "o", sync = true) @Decree(description = "Open a new studio world", aliases = "o", sync = true)
public void open( public void open(
@Param(defaultValue = "default", description = "The dimension to open a studio for", aliases = "dim") @Param(defaultValue = "default", description = "The dimension to open a studio for", aliases = "dim")
IrisDimension dimension, IrisDimension dimension,
@Param(defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s") @Param(defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s")
long seed) { long seed) {
sender().sendMessage(C.GREEN + "Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")"); sender().sendMessage(C.GREEN + "Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")");
Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey()); Iris.service(StudioSVC.class).open(sender(), seed, dimension.getLoadKey());
@ -105,7 +104,7 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Open VSCode for a dimension", aliases = {"vsc", "edit"}) @Decree(description = "Open VSCode for a dimension", aliases = {"vsc", "edit"})
public void vscode( public void vscode(
@Param(defaultValue = "default", description = "The dimension to open VSCode for", aliases = "dim") @Param(defaultValue = "default", description = "The dimension to open VSCode for", aliases = "dim")
IrisDimension dimension IrisDimension dimension
) { ) {
sender().sendMessage(C.GREEN + "Opening VSCode for the \"" + dimension.getName() + "\" pack"); sender().sendMessage(C.GREEN + "Opening VSCode for the \"" + dimension.getName() + "\" pack");
@ -125,9 +124,9 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Create a new studio project", aliases = "+", sync = true) @Decree(description = "Create a new studio project", aliases = "+", sync = true)
public void create( public void create(
@Param(description = "The name of this new Iris Project.") @Param(description = "The name of this new Iris Project.")
String name, String name,
@Param(description = "Copy the contents of an existing project in your packs folder and use it as a template in this new project.", contextual = true) @Param(description = "Copy the contents of an existing project in your packs folder and use it as a template in this new project.", contextual = true)
IrisDimension template) { IrisDimension template) {
if(template != null) { if(template != null) {
Iris.service(StudioSVC.class).create(sender(), name, template.getLoadKey()); Iris.service(StudioSVC.class).create(sender(), name, template.getLoadKey());
@ -138,7 +137,7 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Get the version of a pack") @Decree(description = "Get the version of a pack")
public void version( public void version(
@Param(defaultValue = "default", description = "The dimension get the version of", aliases = "dim", contextual = true) @Param(defaultValue = "default", description = "The dimension get the version of", aliases = "dim", contextual = true)
IrisDimension dimension IrisDimension dimension
) { ) {
sender().sendMessage(C.GREEN + "The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion()); sender().sendMessage(C.GREEN + "The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion());
@ -152,7 +151,7 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Execute a script", aliases = "run", origin = DecreeOrigin.PLAYER) @Decree(description = "Execute a script", aliases = "run", origin = DecreeOrigin.PLAYER)
public void execute( public void execute(
@Param(description = "The script to run") @Param(description = "The script to run")
IrisScript script IrisScript script
) { ) {
engine().getExecution().execute(script.getLoadKey()); engine().getExecution().execute(script.getLoadKey());
@ -177,9 +176,9 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Preview noise gens (External GUI)", aliases = {"generator", "gen"}) @Decree(description = "Preview noise gens (External GUI)", aliases = {"generator", "gen"})
public void explore( public void explore(
@Param(description = "The generator to explore", contextual = true) @Param(description = "The generator to explore", contextual = true)
IrisGenerator generator, IrisGenerator generator,
@Param(description = "The seed to generate with", defaultValue = "12345") @Param(description = "The seed to generate with", defaultValue = "12345")
long seed long seed
) { ) {
if(noGUI()) return; if(noGUI()) return;
@ -208,9 +207,9 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Show loot if a chest were right here", origin = DecreeOrigin.PLAYER, sync = true) @Decree(description = "Show loot if a chest were right here", origin = DecreeOrigin.PLAYER, sync = true)
public void loot( public void loot(
@Param(description = "Fast insertion of items in virtual inventory (may cause performance drop)", defaultValue = "false") @Param(description = "Fast insertion of items in virtual inventory (may cause performance drop)", defaultValue = "false")
boolean fast, boolean fast,
@Param(description = "Whether or not to append to the inventory currently open (if false, clears opened inventory)", defaultValue = "true") @Param(description = "Whether or not to append to the inventory currently open (if false, clears opened inventory)", defaultValue = "true")
boolean add boolean add
) { ) {
if(noStudio()) return; if(noStudio()) return;
@ -251,7 +250,7 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Render a world map (External GUI)", aliases = "render") @Decree(description = "Render a world map (External GUI)", aliases = "render")
public void map( public void map(
@Param(name = "world", description = "The world to open the generator for", contextual = true) @Param(name = "world", description = "The world to open the generator for", contextual = true)
World world World world
) { ) {
if(noGUI()) return; if(noGUI()) return;
@ -267,11 +266,11 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Package a dimension into a compressed format", aliases = "package") @Decree(description = "Package a dimension into a compressed format", aliases = "package")
public void pkg( public void pkg(
@Param(name = "dimension", description = "The dimension pack to compress", contextual = true, defaultValue = "default") @Param(name = "dimension", description = "The dimension pack to compress", contextual = true, defaultValue = "default")
IrisDimension dimension, IrisDimension dimension,
@Param(name = "obfuscate", description = "Whether or not to obfuscate the pack", defaultValue = "false") @Param(name = "obfuscate", description = "Whether or not to obfuscate the pack", defaultValue = "false")
boolean obfuscate, boolean obfuscate,
@Param(name = "minify", description = "Whether or not to minify the pack", defaultValue = "true") @Param(name = "minify", description = "Whether or not to minify the pack", defaultValue = "true")
boolean minify boolean minify
) { ) {
Iris.service(StudioSVC.class).compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify); Iris.service(StudioSVC.class).compilePackage(sender(), dimension.getLoadKey(), obfuscate, minify);
@ -279,7 +278,7 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Profiles the performance of a dimension", origin = DecreeOrigin.PLAYER) @Decree(description = "Profiles the performance of a dimension", origin = DecreeOrigin.PLAYER)
public void profile( public void profile(
@Param(description = "The dimension to profile", contextual = true, defaultValue = "default") @Param(description = "The dimension to profile", contextual = true, defaultValue = "default")
IrisDimension dimension IrisDimension dimension
) { ) {
File pack = dimension.getLoadFile().getParentFile().getParentFile(); File pack = dimension.getLoadFile().getParentFile().getParentFile();
@ -467,9 +466,9 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Summon an Iris Entity", origin = DecreeOrigin.PLAYER) @Decree(description = "Summon an Iris Entity", origin = DecreeOrigin.PLAYER)
public void summon( public void summon(
@Param(description = "The Iris Entity to spawn") @Param(description = "The Iris Entity to spawn")
IrisEntity entity, IrisEntity entity,
@Param(description = "The location at which to spawn the entity", defaultValue = "self") @Param(description = "The location at which to spawn the entity", defaultValue = "self")
Vector location Vector location
) { ) {
if(!sender().isPlayer()) { if(!sender().isPlayer()) {
@ -500,7 +499,7 @@ public class CommandStudio implements DecreeExecutor {
@Decree(description = "Update your dimension projects VSCode workspace") @Decree(description = "Update your dimension projects VSCode workspace")
public void update( public void update(
@Param(description = "The dimension to update the workspace of", contextual = true, defaultValue = "default") @Param(description = "The dimension to update the workspace of", contextual = true, defaultValue = "default")
IrisDimension dimension IrisDimension dimension
) { ) {
sender().sendMessage(C.GOLD + "Updating Code Workspace for " + dimension.getName() + "..."); sender().sendMessage(C.GOLD + "Updating Code Workspace for " + dimension.getName() + "...");
@ -666,7 +665,7 @@ public class CommandStudio implements DecreeExecutor {
String n3 = nn3; String n3 = nn3;
objects.computeIfAbsent(n1, (k1) -> new KMap<>()) objects.computeIfAbsent(n1, (k1) -> new KMap<>())
.computeIfAbsent(n2, (k) -> new KList<>()).addIfMissing(n3); .computeIfAbsent(n2, (k) -> new KList<>()).addIfMissing(n3);
} }
} }
} }

View File

@ -138,10 +138,10 @@ public class CommandWhat implements DecreeExecutor {
for(int xxx = c.getX() - 4; xxx <= c.getX() + 4; xxx++) { for(int xxx = c.getX() - 4; xxx <= c.getX() + 4; xxx++) {
for(int zzz = c.getZ() - 4; zzz <= c.getZ() + 4; zzz++) { for(int zzz = c.getZ() - 4; zzz <= c.getZ() + 4; zzz++) {
IrisToolbelt.access(c.getWorld()).getEngine().getMantle().findMarkers(xxx, zzz, new MatterMarker(marker)) IrisToolbelt.access(c.getWorld()).getEngine().getMantle().findMarkers(xxx, zzz, new MatterMarker(marker))
.convert((i) -> i.toLocation(c.getWorld())).forEach((i) -> { .convert((i) -> i.toLocation(c.getWorld())).forEach((i) -> {
J.s(() -> BlockSignal.of(i.getBlock(), 100)); J.s(() -> BlockSignal.of(i.getBlock(), 100));
v.incrementAndGet(); v.incrementAndGet();
}); });
} }
} }

View File

@ -473,7 +473,7 @@ public interface Engine extends DataProvider, Fallible, LootProvider, BlockUpdat
if(i == null) if(i == null)
continue; continue;
b++; b++;
items.addAll(i.getLoot(debug, items.isEmpty(), rng, slot, x, y, z, b + b, mgf + b)); items.addAll(i.getLoot(debug, rng, slot, x, y, z));
} }
if(PaperLib.isPaper() && getWorld().hasRealWorld()) { if(PaperLib.isPaper() && getWorld().hasRealWorld()) {

View File

@ -257,7 +257,7 @@ public class IrisEntity extends IrisRegistrant {
for(String fi : getLoot().getTables()) { for(String fi : getLoot().getTables()) {
IrisLootTable i = gen.getData().getLootLoader().load(fi); IrisLootTable i = gen.getData().getLootLoader().load(fi);
items.addAll(i.getLoot(gen.isStudio(), false, rng.nextParallelRNG(345911), InventorySlotType.STORAGE, finalAt.getBlockX(), finalAt.getBlockY(), finalAt.getBlockZ(), 8, 4)); items.addAll(i.getLoot(gen.isStudio(), rng.nextParallelRNG(345911), InventorySlotType.STORAGE, finalAt.getBlockX(), finalAt.getBlockY(), finalAt.getBlockZ()));
} }
return items; return items;

View File

@ -63,7 +63,7 @@ public class IrisLootTable extends IrisRegistrant {
@ArrayType(min = 1, type = IrisLoot.class) @ArrayType(min = 1, type = IrisLoot.class)
private KList<IrisLoot> loot = new KList<>(); private KList<IrisLoot> loot = new KList<>();
public KList<ItemStack> getLoot(boolean debug, boolean doSomething, RNG rng, InventorySlotType slot, int x, int y, int z, int gg, int ffs) { public KList<ItemStack> getLoot(boolean debug, RNG rng, InventorySlotType slot, int x, int y, int z) {
KList<ItemStack> lootf = new KList<>(); KList<ItemStack> lootf = new KList<>();
int m = 0; int m = 0;