mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-19 10:43:14 +00:00
simplify studio checks + ir s loot
This commit is contained in:
parent
3af8f4772f
commit
5c0c680f56
@ -21,16 +21,14 @@ package com.volmit.iris.core.decrees;
|
|||||||
import com.volmit.iris.Iris;
|
import com.volmit.iris.Iris;
|
||||||
import com.volmit.iris.core.IrisSettings;
|
import com.volmit.iris.core.IrisSettings;
|
||||||
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
|
||||||
import com.volmit.iris.engine.object.basic.IrisPosition;
|
import com.volmit.iris.engine.object.basic.IrisPosition;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.common.IrisScript;
|
import com.volmit.iris.engine.object.common.IrisScript;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||||
import com.volmit.iris.engine.object.jigsaw.IrisJigsawStructure;
|
import com.volmit.iris.engine.object.loot.IrisLootTable;
|
||||||
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
import com.volmit.iris.engine.object.noise.IrisGenerator;
|
||||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||||
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||||
import com.volmit.iris.util.decree.annotations.Decree;
|
import com.volmit.iris.util.decree.annotations.Decree;
|
||||||
@ -38,35 +36,30 @@ import com.volmit.iris.util.decree.annotations.Param;
|
|||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
import com.volmit.iris.util.format.Form;
|
import com.volmit.iris.util.format.Form;
|
||||||
import com.volmit.iris.util.function.Function2;
|
import com.volmit.iris.util.function.Function2;
|
||||||
import com.volmit.iris.util.io.IO;
|
|
||||||
import com.volmit.iris.util.json.JSONCleaner;
|
import com.volmit.iris.util.json.JSONCleaner;
|
||||||
import com.volmit.iris.util.json.JSONObject;
|
|
||||||
import com.volmit.iris.util.math.RNG;
|
import com.volmit.iris.util.math.RNG;
|
||||||
import com.volmit.iris.util.plugin.VolmitSender;
|
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.function.Supplier;
|
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 DecIrisStudio implements DecreeExecutor
|
public class DecIrisStudio 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(name = "dimension", defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
||||||
IrisDimension dimension,
|
IrisDimension dimension,
|
||||||
@Param(name = "seed", defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s")
|
@Param(name = "seed", defaultValue = "1337", description = "The seed to generate the studio with", aliases = "s")
|
||||||
long seed)
|
long seed) {
|
||||||
{
|
|
||||||
success("Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")");
|
success("Opening studio for the \"" + dimension.getName() + "\" pack (seed: " + seed + ")");
|
||||||
Iris.proj.open(sender(), seed, dimension.getLoadKey());
|
Iris.proj.open(sender(), seed, dimension.getLoadKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Close an open studio project", aliases = "x", sync = true)
|
@Decree(description = "Close an open studio project", aliases = "x", sync = true)
|
||||||
public void close()
|
public void close() {
|
||||||
{
|
|
||||||
if (!Iris.proj.isProjectOpen()) {
|
if (!Iris.proj.isProjectOpen()) {
|
||||||
error("No open studio projects.");
|
error("No open studio projects.");
|
||||||
return;
|
return;
|
||||||
@ -80,8 +73,7 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
public void version(
|
public void version(
|
||||||
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension get the version of", aliases = "dim")
|
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension get the version of", aliases = "dim")
|
||||||
IrisDimension dimension
|
IrisDimension dimension
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
success("The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion());
|
success("The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,42 +81,35 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
public void beautify(
|
public void beautify(
|
||||||
@Param(name = "dimension", defaultValue = "overworld", description = "The to-beautify dimension", aliases = "dim")
|
@Param(name = "dimension", defaultValue = "overworld", description = "The to-beautify dimension", aliases = "dim")
|
||||||
IrisDimension dimension
|
IrisDimension dimension
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
File folder = dimension.getLoadFile();
|
File folder = dimension.getLoadFile();
|
||||||
success("Cleaned " + Form.f(JSONCleaner.clean(sender(), folder)) + " JSON Files");
|
success("Cleaned " + Form.f(JSONCleaner.clean(sender(), folder)) + " JSON Files");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Beatify a pack - must be in studio!", aliases = {"beauty", "prettify"})
|
@Decree(description = "Beatify a pack - must be in studio!", aliases = {"beauty", "prettify"})
|
||||||
public void beautify()
|
public void beautify() {
|
||||||
{
|
if (noStudio()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
File folder = Iris.proj.getActiveProject().getPath();
|
File folder = Iris.proj.getActiveProject().getPath();
|
||||||
success("Cleaned " + Form.f(JSONCleaner.clean(sender(), folder)) + " JSON Files");
|
success("Cleaned " + Form.f(JSONCleaner.clean(sender(), folder)) + " JSON Files");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Convert objects in the \"convert\" folder", aliases = "conv")
|
@Decree(description = "Convert objects in the \"convert\" folder", aliases = "conv")
|
||||||
public void convert()
|
public void convert() {
|
||||||
{
|
|
||||||
Iris.convert.check(sender());
|
Iris.convert.check(sender());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Decree(description = "Edit the biome you're currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Edit the biome you're currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER)
|
||||||
public void editbiome()
|
public void editbiome() {
|
||||||
{
|
|
||||||
if (!Iris.proj.isProjectOpen()){
|
if (noStudio()){
|
||||||
error("The is no studio currently open!");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Iris.proj.getActiveProject().getActiveProvider().getEngine().getWorld().realWorld().equals(player().getWorld())){
|
|
||||||
error("You must be in a studio world to edit a biome!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
File f = Iris.proj.getActiveProject().getActiveProvider().getEngine().getBiome(
|
File f = engine().getBiome(
|
||||||
player().getLocation().getBlockX(),
|
player().getLocation().getBlockX(),
|
||||||
player().getLocation().getBlockY(),
|
player().getLocation().getBlockY(),
|
||||||
player().getLocation().getBlockZ()).getLoadFile();
|
player().getLocation().getBlockZ()).getLoadFile();
|
||||||
@ -139,15 +124,13 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
public void execute(
|
public void execute(
|
||||||
@Param(name = "script", description = "The script to run", aliases = {"s", "scr"})
|
@Param(name = "script", description = "The script to run", aliases = {"s", "scr"})
|
||||||
IrisScript script
|
IrisScript script
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
engine().getExecution().execute(script);
|
engine().getExecution().execute(script);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Open the noise explorer (must have a local server!)", aliases = "nmap")
|
@Decree(description = "Open the noise explorer (must have a local server!)", aliases = "nmap")
|
||||||
public void noise()
|
public void noise() {
|
||||||
{
|
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
||||||
if (!IrisSettings.get().isUseServerLaunchedGuis()){
|
|
||||||
error("To use Iris noise GUIs, please enable serverLaunchedGUIs in the settings");
|
error("To use Iris noise GUIs, please enable serverLaunchedGUIs in the settings");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -161,9 +144,8 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
@Param(name = "generator", description = "The generator to explore", aliases = {"gen", "g"})
|
@Param(name = "generator", description = "The generator to explore", aliases = {"gen", "g"})
|
||||||
IrisGenerator generator,
|
IrisGenerator generator,
|
||||||
@Param(name = "seed", description = "The seed to generate with", aliases = "s", defaultValue = "12345")
|
@Param(name = "seed", description = "The seed to generate with", aliases = "s", defaultValue = "12345")
|
||||||
long seed)
|
long seed) {
|
||||||
{
|
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
||||||
if (!IrisSettings.get().isUseServerLaunchedGuis()){
|
|
||||||
error("To use Iris noise GUIs, please enable serverLaunchedGUIs in the settings");
|
error("To use Iris noise GUIs, please enable serverLaunchedGUIs in the settings");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -183,8 +165,7 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
public void find(
|
public void find(
|
||||||
@Param(name = "biome", description = "The biome to find", aliases = "b")
|
@Param(name = "biome", description = "The biome to find", aliases = "b")
|
||||||
IrisBiome biome
|
IrisBiome biome
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
IrisPosition l = engine().lookForBiome(biome, 10000, (v) -> message("Looking for " + C.BOLD + C.WHITE + biome.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
IrisPosition l = engine().lookForBiome(biome, 10000, (v) -> message("Looking for " + C.BOLD + C.WHITE + biome.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
||||||
|
|
||||||
@ -201,8 +182,7 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
public void find(
|
public void find(
|
||||||
@Param(name = "region", description = "The region to find", aliases = "r")
|
@Param(name = "region", description = "The region to find", aliases = "r")
|
||||||
IrisRegion region
|
IrisRegion region
|
||||||
)
|
) {
|
||||||
{
|
|
||||||
J.a(() -> {
|
J.a(() -> {
|
||||||
IrisPosition l = engine().lookForRegion(region, 10000, (v) -> message("Looking for " + C.BOLD + C.WHITE + region.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
IrisPosition l = engine().lookForRegion(region, 10000, (v) -> message("Looking for " + C.BOLD + C.WHITE + region.getName() + C.RESET + C.GRAY + ": Checked " + Form.f(v) + " Places"));
|
||||||
|
|
||||||
@ -216,20 +196,42 @@ public class DecIrisStudio implements DecreeExecutor
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Decree(description = "Hotload a studio", aliases = {"hot", "h", "reload"}, origin = DecreeOrigin.PLAYER)
|
@Decree(description = "Hotload a studio", aliases = {"hot", "h", "reload"}, origin = DecreeOrigin.PLAYER)
|
||||||
public void hotload()
|
public void hotload() {
|
||||||
{
|
if (noStudio()){
|
||||||
if (!engine().isStudio()){
|
|
||||||
error("You must be in an Iris Studio");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (access() == null){
|
|
||||||
error("Could not gain access to the generator of your studio");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
access().hotload();
|
access().hotload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Decree(description = "Show loot if a chest were right here", origin = DecreeOrigin.PLAYER)
|
||||||
|
public void loot()
|
||||||
|
{
|
||||||
|
if (noStudio()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
KList<IrisLootTable> tables = engine().getLootTables(RNG.r, player().getLocation().getBlock());
|
||||||
|
Inventory inv = Bukkit.createInventory(null, 27 * 2);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if no studio is open & the player
|
||||||
|
*/
|
||||||
|
private boolean noStudio(){
|
||||||
|
if (!sender().isPlayer()){
|
||||||
|
error("Players only (this is a config error. Ask support to add DecreeOrigin.PLAYER)");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!Iris.proj.isProjectOpen()){
|
||||||
|
error("No studio world is open!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!engine().isStudio()){
|
||||||
|
error("You must be in a studio world!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user