update description and add defaults for #289

untested
This commit is contained in:
Bella 2020-02-17 11:31:27 -05:00
parent ffee6b0d21
commit 9a7a98d132
3 changed files with 34 additions and 21 deletions

View File

@ -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";

View File

@ -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 <command>").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 +<block> : Adds a block to the list.");
Command.sendChatMessage(".xray -<block> : 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("+<block>: Adds a block to the list");
Command.sendChatMessage("-<block>: 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 + ">");
}
}
}

View File

@ -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();