mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +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.core.IrisSettings;
|
||||
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.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.common.IrisScript;
|
||||
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.regional.IrisRegion;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.decree.DecreeExecutor;
|
||||
import com.volmit.iris.util.decree.DecreeOrigin;
|
||||
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.Form;
|
||||
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.JSONObject;
|
||||
import com.volmit.iris.util.math.RNG;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@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)
|
||||
public void open(
|
||||
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension to open a studio for", aliases = "dim")
|
||||
IrisDimension dimension,
|
||||
@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 + ")");
|
||||
Iris.proj.open(sender(), seed, dimension.getLoadKey());
|
||||
}
|
||||
|
||||
@Decree(description = "Close an open studio project", aliases = "x", sync = true)
|
||||
public void close()
|
||||
{
|
||||
public void close() {
|
||||
if (!Iris.proj.isProjectOpen()) {
|
||||
error("No open studio projects.");
|
||||
return;
|
||||
@ -80,8 +73,7 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
public void version(
|
||||
@Param(name = "dimension", defaultValue = "overworld", description = "The dimension get the version of", aliases = "dim")
|
||||
IrisDimension dimension
|
||||
)
|
||||
{
|
||||
) {
|
||||
success("The \"" + dimension.getName() + "\" pack has version: " + dimension.getVersion());
|
||||
}
|
||||
|
||||
@ -89,42 +81,35 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
public void beautify(
|
||||
@Param(name = "dimension", defaultValue = "overworld", description = "The to-beautify dimension", aliases = "dim")
|
||||
IrisDimension dimension
|
||||
)
|
||||
{
|
||||
) {
|
||||
File folder = dimension.getLoadFile();
|
||||
success("Cleaned " + Form.f(JSONCleaner.clean(sender(), folder)) + " JSON Files");
|
||||
}
|
||||
|
||||
@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();
|
||||
success("Cleaned " + Form.f(JSONCleaner.clean(sender(), folder)) + " JSON Files");
|
||||
}
|
||||
|
||||
@Decree(description = "Convert objects in the \"convert\" folder", aliases = "conv")
|
||||
public void convert()
|
||||
{
|
||||
public void convert() {
|
||||
Iris.convert.check(sender());
|
||||
}
|
||||
|
||||
|
||||
@Decree(description = "Edit the biome you're currently in", aliases = {"ebiome", "eb"}, origin = DecreeOrigin.PLAYER)
|
||||
public void editbiome()
|
||||
{
|
||||
if (!Iris.proj.isProjectOpen()){
|
||||
error("The is no studio currently open!");
|
||||
public void editbiome() {
|
||||
|
||||
if (noStudio()){
|
||||
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 {
|
||||
File f = Iris.proj.getActiveProject().getActiveProvider().getEngine().getBiome(
|
||||
File f = engine().getBiome(
|
||||
player().getLocation().getBlockX(),
|
||||
player().getLocation().getBlockY(),
|
||||
player().getLocation().getBlockZ()).getLoadFile();
|
||||
@ -138,16 +123,14 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
@Decree(description = "Execute a script", aliases = {"ex", "exec", "run"}, origin = DecreeOrigin.PLAYER)
|
||||
public void execute(
|
||||
@Param(name = "script", description = "The script to run", aliases = {"s", "scr"})
|
||||
IrisScript script
|
||||
)
|
||||
{
|
||||
IrisScript script
|
||||
) {
|
||||
engine().getExecution().execute(script);
|
||||
}
|
||||
|
||||
@Decree(description = "Open the noise explorer (must have a local server!)", aliases = "nmap")
|
||||
public void noise()
|
||||
{
|
||||
if (!IrisSettings.get().isUseServerLaunchedGuis()){
|
||||
public void noise() {
|
||||
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
||||
error("To use Iris noise GUIs, please enable serverLaunchedGUIs in the settings");
|
||||
return;
|
||||
}
|
||||
@ -161,9 +144,8 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
@Param(name = "generator", description = "The generator to explore", aliases = {"gen", "g"})
|
||||
IrisGenerator generator,
|
||||
@Param(name = "seed", description = "The seed to generate with", aliases = "s", defaultValue = "12345")
|
||||
long seed)
|
||||
{
|
||||
if (!IrisSettings.get().isUseServerLaunchedGuis()){
|
||||
long seed) {
|
||||
if (!IrisSettings.get().isUseServerLaunchedGuis()) {
|
||||
error("To use Iris noise GUIs, please enable serverLaunchedGUIs in the settings");
|
||||
return;
|
||||
}
|
||||
@ -182,9 +164,8 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
@Decree(description = "Find any biome", aliases = {"goto", "g"}, origin = DecreeOrigin.PLAYER)
|
||||
public void find(
|
||||
@Param(name = "biome", description = "The biome to find", aliases = "b")
|
||||
IrisBiome biome
|
||||
)
|
||||
{
|
||||
IrisBiome biome
|
||||
) {
|
||||
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"));
|
||||
|
||||
@ -201,8 +182,7 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
public void find(
|
||||
@Param(name = "region", description = "The region to find", aliases = "r")
|
||||
IrisRegion region
|
||||
)
|
||||
{
|
||||
) {
|
||||
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"));
|
||||
|
||||
@ -216,20 +196,42 @@ public class DecIrisStudio implements DecreeExecutor
|
||||
}
|
||||
|
||||
@Decree(description = "Hotload a studio", aliases = {"hot", "h", "reload"}, origin = DecreeOrigin.PLAYER)
|
||||
public void hotload()
|
||||
{
|
||||
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");
|
||||
public void hotload() {
|
||||
if (noStudio()){
|
||||
return;
|
||||
}
|
||||
|
||||
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