From 9a7a98d132bdbb8c1899e09ab65417dc475e52db Mon Sep 17 00:00:00 2001 From: Bella Date: Mon, 17 Feb 2020 11:31:27 -0500 Subject: [PATCH] update description and add defaults for #289 untested --- .../java/me/zeroeightsix/kami/KamiMod.java | 4 +- .../kami/command/commands/XRayCommand.java | 40 ++++++++++--------- .../kami/module/modules/render/XRay.java | 11 ++++- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/KamiMod.java b/src/main/java/me/zeroeightsix/kami/KamiMod.java index 1d2ef1bdd..55a9f7a9c 100644 --- a/src/main/java/me/zeroeightsix/kami/KamiMod.java +++ b/src/main/java/me/zeroeightsix/kami/KamiMod.java @@ -55,7 +55,7 @@ import java.util.Optional; /** * Created by 086 on 7/11/2017. - * Updated by S-B99 on 07/02/19 + * Updated by S-B99 on 17/02/19 */ @Mod( modid = KamiMod.MODID, @@ -65,8 +65,8 @@ import java.util.Optional; ) public class KamiMod { - static final String MODID = "kamiblue"; static final String MODNAME = "KAMI Blue"; + public static final String MODID = "kamiblue"; public static final String MODVER = "v1.1.2"; public static final String APP_ID = "638403216278683661"; diff --git a/src/main/java/me/zeroeightsix/kami/command/commands/XRayCommand.java b/src/main/java/me/zeroeightsix/kami/command/commands/XRayCommand.java index f82694eba..83f587d3a 100644 --- a/src/main/java/me/zeroeightsix/kami/command/commands/XRayCommand.java +++ b/src/main/java/me/zeroeightsix/kami/command/commands/XRayCommand.java @@ -8,10 +8,11 @@ import net.minecraft.block.Block; /** * Created by 20kdc on 17/02/2020. + * Updated by S-B99 on 17/02/20 */ public class XRayCommand extends Command { public XRayCommand() { - super("xray", new ChunkBuilder().append("subcommand").build(), "wallhack", "x-ray"); + super("xray", new ChunkBuilder().append("help ").append("list|clear|+block|-block").build(), "wallhack", "x-ray"); setDescription("Allows you to add or remove blocks from the &7xray &8module"); } @@ -19,37 +20,40 @@ public class XRayCommand extends Command { public void call(String[] args) { XRay xr = (XRay) ModuleManager.getModuleByName("XRay"); if (xr == null) { - Command.sendChatMessage("&cThe XRay module is not available for some reason."); + Command.sendErrorMessage("&cThe XRay module is not available for some reason. Make sure the name you're calling is correct and that you have the module installed!!"); return; } if (!xr.isEnabled()) { - Command.sendChatMessage("&cWarning: The XRay module is not enabled."); - Command.sendChatMessage("&cThese commands will still have effects, but will not visibly do anything."); + Command.sendWarningMessage("&cWarning: The XRay module is not enabled!"); + Command.sendWarningMessage("&cThese commands will still have effects, but will not visibly do anything."); } for (String s : args) { if (s == null) continue; if (s.equalsIgnoreCase("help")) { - Command.sendChatMessage("The XRay module has a list of blocks."); - Command.sendChatMessage("Normally, the XRay module hides these blocks."); - Command.sendChatMessage("When the Invert setting is on, the XRay only shows these blocks."); - Command.sendChatMessage("This command is a convenient way to quickly edit the list."); + Command.sendChatMessage("The XRay module has a list of blocks"); + Command.sendChatMessage("Normally, the XRay module hides these blocks"); + Command.sendChatMessage("When the Invert setting is on, the XRay only shows these blocks"); + Command.sendChatMessage("This command is a convenient way to quickly edit the list"); Command.sendChatMessage("XRay Subcommands:"); - Command.sendChatMessage(".xray help : Shows this text."); - Command.sendChatMessage(".xray clear : Removes all blocks from the XRay block list."); - Command.sendChatMessage(".xray show : Shows the list."); - Command.sendChatMessage(".xray + : Adds a block to the list."); - Command.sendChatMessage(".xray - : Removes a block from the list."); + Command.sendChatMessage("clear: Removes all blocks from the XRay block list"); + Command.sendChatMessage("list: Prints the list of selected blocks"); + Command.sendChatMessage("default: Resets the list to the default list"); + Command.sendChatMessage("+: Adds a block to the list"); + Command.sendChatMessage("-: Removes a block from the list"); } else if (s.equalsIgnoreCase("clear")) { xr.extClear(); - Command.sendChatMessage("Cleared the XRay block list."); - } else if (s.equalsIgnoreCase("show")) { - Command.sendChatMessage(xr.extGet()); + Command.sendWarningMessage("Cleared the XRay block list"); + } else if (s.equalsIgnoreCase("default")) { + xr.extDefault(); + Command.sendChatMessage("Reset the XRay block list to default"); + } else if (s.equalsIgnoreCase("list")) { + Command.sendChatMessage("\n" + xr.extGet()); } else if (s.startsWith("+") || s.startsWith("-")) { String name = s.substring(1); Block b = Block.getBlockFromName(name); if (b == null) { - Command.sendChatMessage("&cInvalid block name " + name + "."); + Command.sendChatMessage("&cInvalid block name <" + name + ">"); } else { if (s.startsWith("+")) { xr.extAdd(name); @@ -58,7 +62,7 @@ public class XRayCommand extends Command { } } } else { - Command.sendChatMessage("&cInvalid subcommand " + s + "."); + Command.sendChatMessage("&cInvalid subcommand <" + s + ">"); } } } diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/render/XRay.java b/src/main/java/me/zeroeightsix/kami/module/modules/render/XRay.java index 0355a6421..69aef9bea 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/render/XRay.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/render/XRay.java @@ -28,11 +28,14 @@ import me.zeroeightsix.kami.KamiMod; /** * Created by 20kdc on 15/02/2020. + * Updated by S-B99 on 17/02/20 */ -@Module.Info(name = "XRay", category = Module.Category.RENDER, description = "Filters away common blocks.") +@Module.Info(name = "XRay", category = Module.Category.RENDER, description = "See through common blocks!") @EventBusSubscriber(modid = KamiMod.MODID) public class XRay extends Module { + private String[] defaultList = new String[]{"grass", "dirt", "netherrack", "gravel", "sand", "stone"}; + // A default reasonable configuration for the XRay. Most people will want to use it like this. private static final String DEFAULT_XRAY_CONFIG = "minecraft:grass,minecraft:dirt,minecraft:netherrack,minecraft:gravel,minecraft:sand,minecraft:stone"; // Split by ',' & each element trimmed (this is a bit weird but it works for now?) @@ -85,6 +88,12 @@ public class XRay extends Module { public void extClear() { hiddenBlockNames.setValue(""); } + // Resets the list to default + public void extDefault() { + extClear(); + for (String s : defaultList) extAdd(s); + // TODO: check if instead of using an array I can just make it equal to DEFAULT_XRAY_CONFIG + } private String extGetInternal(Block filter) { StringBuilder sb = new StringBuilder();