From db64548d91362dc29828e19dc0e19994851bfc78 Mon Sep 17 00:00:00 2001 From: Alex <30688640+casKd-dev@users.noreply.github.com> Date: Mon, 27 Apr 2020 12:19:55 +0200 Subject: [PATCH 1/4] Add module --- .../impl/module/misc/StorageAlertModule.java | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java new file mode 100644 index 0000000..b1a78fe --- /dev/null +++ b/src/main/java/me/rigamortis/seppuku/impl/module/misc/StorageAlertModule.java @@ -0,0 +1,76 @@ +package me.rigamortis.seppuku.impl.module.misc; + +import me.rigamortis.seppuku.Seppuku; +import me.rigamortis.seppuku.api.event.EventStageable; +import me.rigamortis.seppuku.api.event.network.EventReceivePacket; +import me.rigamortis.seppuku.api.module.Module; +import me.rigamortis.seppuku.api.value.Value; +import net.minecraft.client.Minecraft; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.network.play.server.SPacketChunkData; +import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; + +/** + * Author Seth + * 8/25/2019 @ 10:27 PM. + */ +public final class StorageAlertModule extends Module { + + public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between alert modes.", Mode.CHAT); + public final Value chests = new Value("Chests", new String[]{"Chests", "chest"}, "Count chests.", true); + public final Value echests = new Value("EnderChests", new String[]{"EnderChests", "echest"}, "Count ender chests.", false); + public final Value shulkers = new Value("ShulkerBoxes", new String[]{"ShulkerBoxes", "shul"}, "Count shulkers.", false); + public final Value hoppers = new Value("Hoppers", new String[]{"Hoppers", "hopp"}, "Count hoppers.", false); + public final Value droppers = new Value("Droppers", new String[]{"Droppers", "drop"}, "Count droppers.", false); + public final Value dispensers = new Value("Dispensers", new String[]{"Dispensers", "disp"}, "Count dispensers.", false); + public final Value stands = new Value("BrewingStands", new String[]{"BrewingStands", "brew"}, "Count brewing stands.", false); + + private enum Mode { + CHAT, NOTIFICATION, BOTH + } + + public StorageAlertModule() { + super("StorageAlert", new String[]{"StorageAlerts"}, "Alerts you how many storage blocks are in a chunk when it's loaded", "NONE", -1, ModuleType.MISC); + } + + @Listener + public void recievePacket(EventReceivePacket event) { + if (event.getStage() == EventStageable.EventStage.POST) { + if (event.getPacket() instanceof SPacketChunkData) { + final SPacketChunkData packet = (SPacketChunkData) event.getPacket(); + + final Minecraft mc = Minecraft.getMinecraft(); + + int count = 0; + + for(NBTTagCompound tag : packet.getTileEntityTags()) { + final String id = tag.getString("id"); + + if( + (this.chests.getValue() && (id.equals("minecraft:chest") || id.equals("minecraft:trapped_chest"))) || + (this.echests.getValue() && id.equals("minecraft:ender_chest")) || + (this.shulkers.getValue() && id.equals("minecraft:shulker_box")) || + (this.hoppers.getValue() && id.equals("minecraft:hopper")) || + (this.droppers.getValue() && id.equals("minecraft:dropper")) || + (this.dispensers.getValue() && id.equals("minecraft:dispenser")) || + (this.stands.getValue() && id.equals("minecraft:brewing_stand")) + ) { + count++; + } + } + + if(count > 0) { + final String message = count + " storage blocks located at X: " + packet.getChunkX() * 16 + " Z: " + packet.getChunkZ() * 16; + if (this.mode.getValue() == Mode.CHAT || this.mode.getValue() == Mode.BOTH) { + Seppuku.INSTANCE.logChat(message); + } + if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) { + Seppuku.INSTANCE.getNotificationManager().addNotification("", message); + } + } + + } + } + } + +} From 21a179676d74687ab1eb60a4e40a6d00aaa5d2bc Mon Sep 17 00:00:00 2001 From: Alex <30688640+casKd-dev@users.noreply.github.com> Date: Mon, 27 Apr 2020 12:20:26 +0200 Subject: [PATCH 2/4] Replace ChestAlert --- .../impl/module/misc/ChestAlertModule.java | 61 ------------------- 1 file changed, 61 deletions(-) delete mode 100644 src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java diff --git a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java b/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java deleted file mode 100644 index 6a653ca..0000000 --- a/src/main/java/me/rigamortis/seppuku/impl/module/misc/ChestAlertModule.java +++ /dev/null @@ -1,61 +0,0 @@ -package me.rigamortis.seppuku.impl.module.misc; - -import me.rigamortis.seppuku.Seppuku; -import me.rigamortis.seppuku.api.event.EventStageable; -import me.rigamortis.seppuku.api.event.network.EventReceivePacket; -import me.rigamortis.seppuku.api.module.Module; -import me.rigamortis.seppuku.api.value.Value; -import net.minecraft.client.Minecraft; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.play.server.SPacketChunkData; -import team.stiff.pomelo.impl.annotated.handler.annotation.Listener; - -/** - * Author Seth - * 8/25/2019 @ 10:27 PM. - */ -public final class ChestAlertModule extends Module { - - public final Value mode = new Value("Mode", new String[]{"Mode", "M"}, "Change between alert modes.", Mode.CHAT); - - private enum Mode { - CHAT, NOTIFICATION, BOTH - } - - public ChestAlertModule() { - super("ChestAlert", new String[]{"ChestAlerts"}, "Alerts you how many chests are in a chunk when it's loaded", "NONE", -1, ModuleType.MISC); - } - - @Listener - public void recievePacket(EventReceivePacket event) { - if (event.getStage() == EventStageable.EventStage.POST) { - if (event.getPacket() instanceof SPacketChunkData) { - final SPacketChunkData packet = (SPacketChunkData) event.getPacket(); - - final Minecraft mc = Minecraft.getMinecraft(); - - int count = 0; - - for(NBTTagCompound tag : packet.getTileEntityTags()) { - final String id = tag.getString("id"); - - if(id.equals("minecraft:chest")) { - count++; - } - } - - if(count > 0) { - final String message = count + " Chests located at X: " + packet.getChunkX() * 16 + " Z: " + packet.getChunkZ() * 16; - if (this.mode.getValue() == Mode.CHAT || this.mode.getValue() == Mode.BOTH) { - Seppuku.INSTANCE.logChat(message); - } - if (this.mode.getValue() == Mode.NOTIFICATION || this.mode.getValue() == Mode.BOTH) { - Seppuku.INSTANCE.getNotificationManager().addNotification("", message); - } - } - - } - } - } - -} From 43f3098a823637ca71e8eac31f654eaa45eb1408 Mon Sep 17 00:00:00 2001 From: Alex <30688640+casKd-dev@users.noreply.github.com> Date: Mon, 27 Apr 2020 12:21:44 +0200 Subject: [PATCH 3/4] Replace module in the manager --- .../me/rigamortis/seppuku/impl/management/ModuleManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java index fca4822..6a56424 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java @@ -17,8 +17,6 @@ import me.rigamortis.seppuku.impl.module.misc.*; import me.rigamortis.seppuku.impl.module.movement.*; import me.rigamortis.seppuku.impl.module.player.*; import me.rigamortis.seppuku.impl.module.render.*; -import me.rigamortis.seppuku.impl.module.ui.HudEditorModule; -import me.rigamortis.seppuku.impl.module.world.*; import java.io.File; import java.lang.reflect.Field; @@ -134,7 +132,7 @@ public final class ModuleManager { add(new ObsidianReplaceModule()); add(new ChatTimeStampsModule()); add(new HudEditorModule()); - add(new ChestAlertModule()); + add(new StorageAlertModule()); add(new StrafeModule()); add(new MapBypassModule()); add(new NoBossHealthModule()); From b7a1cc34f69d67f8382fd0dd8c11e036c807f4a6 Mon Sep 17 00:00:00 2001 From: Alex <30688640+casKd-dev@users.noreply.github.com> Date: Mon, 27 Apr 2020 12:26:01 +0200 Subject: [PATCH 4/4] Fix accidental deletion --- .../me/rigamortis/seppuku/impl/management/ModuleManager.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java index 6a56424..485ce25 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java +++ b/src/main/java/me/rigamortis/seppuku/impl/management/ModuleManager.java @@ -17,6 +17,8 @@ import me.rigamortis.seppuku.impl.module.misc.*; import me.rigamortis.seppuku.impl.module.movement.*; import me.rigamortis.seppuku.impl.module.player.*; import me.rigamortis.seppuku.impl.module.render.*; +import me.rigamortis.seppuku.impl.module.ui.HudEditorModule; +import me.rigamortis.seppuku.impl.module.world.*; import java.io.File; import java.lang.reflect.Field;