From 984d294baba4ce2553e1439b00b9d996169d7857 Mon Sep 17 00:00:00 2001 From: RePixelatedMC <107539181+RePixelatedMC@users.noreply.github.com> Date: Thu, 10 Apr 2025 13:15:19 +0200 Subject: [PATCH] wait --- .../iris/core/commands/CommandEdit.java | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java b/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java index 345b3f214..ace3dc7d9 100644 --- a/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java +++ b/core/src/main/java/com/volmit/iris/core/commands/CommandEdit.java @@ -19,6 +19,7 @@ package com.volmit.iris.core.commands; import com.volmit.iris.Iris; +import com.volmit.iris.core.nms.INMS; import com.volmit.iris.core.service.StudioSVC; import com.volmit.iris.engine.object.*; import com.volmit.iris.util.decree.DecreeExecutor; @@ -26,6 +27,7 @@ import com.volmit.iris.util.decree.DecreeOrigin; import com.volmit.iris.util.decree.annotations.Decree; import com.volmit.iris.util.decree.annotations.Param; import com.volmit.iris.util.format.C; +import org.bukkit.block.Biome; import java.awt.*; @@ -51,12 +53,31 @@ public class CommandEdit implements DecreeExecutor { @Decree(description = "Edit the biome you specified", aliases = {"b"}, origin = DecreeOrigin.PLAYER) - public void biome(@Param(contextual = false, description = "The biome to edit") IrisBiome biome) { + public void biome(@Param(contextual = false, description = "The biome to edit", defaultValue = "---", customHandler = NullableBiomeHandler.class) IrisBiome biome) { if (noStudio()) { return; } + if (biome == null) { + try { + IrisBiome b = engine().getBiome(player().getLocation().getBlockX(), player().getLocation().getBlockY() - player().getWorld().getMinHeight(), player().getLocation().getBlockZ()); + Desktop.getDesktop().open(b.getLoadFile()); + sender().sendMessage(C.GREEN + "Opening " + b.getTypeName() + " " + b.getLoadFile().getName().split("\\Q.\\E")[0] + " in VSCode! "); + } catch (Throwable e) { + Iris.reportError(e); + sender().sendMessage("Non-Iris Biome: " + player().getLocation().getBlock().getBiome().name()); + if (player().getLocation().getBlock().getBiome().equals(Biome.CUSTOM)) { + try { + sender().sendMessage("Data Pack Biome: " + INMS.get().getTrueBiomeBaseKey(player().getLocation()) + " (ID: " + INMS.get().getTrueBiomeBaseId(INMS.get().getTrueBiomeBase(player().getLocation())) + ")"); + } catch (Throwable ee) { + Iris.reportError(ee); + } + } + } + return; + } + try { - if (biome == null || biome.getLoadFile() == null) { + if (biome.getLoadFile() == null) { sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?"); return; } @@ -69,10 +90,20 @@ public class CommandEdit implements DecreeExecutor { } @Decree(description = "Edit the region you specified", aliases = {"r"}, origin = DecreeOrigin.PLAYER) - public void region(@Param(contextual = false, description = "The region to edit") IrisRegion region) { + public void region(@Param(contextual = false, description = "The region to edit", defaultValue = "---", customHandler = NullableRegionHandler.class) IrisRegion region) { if (noStudio()) { return; } + if (region == null) { + try { + IrisRegion r = engine().getRegion(player().getLocation().getBlockX(), player().getLocation().getBlockZ()); + Desktop.getDesktop().open(r.getLoadFile()); + sender().sendMessage(C.GREEN + "Opening " + r.getTypeName() + " " + r.getLoadFile().getName().split("\\Q.\\E")[0] + " in VSCode! "); + } catch (Throwable e) { + sender().sendMessage(C.RED + "Failed to get region."); + } + return; + } try { if (region == null || region.getLoadFile() == null) { sender().sendMessage(C.GOLD + "Cannot find the file; Perhaps it was not loaded directly from a file?");