From ab34fa8612f8934a6f1db317ae872a735a59d7cc Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Fri, 19 Sep 2025 11:15:11 +0000 Subject: [PATCH] feat: Add notification and disconnect on elytra depletion This commit adds a feature to the BaseFinder module that checks if the bot has run out of elytras while the ElytraController is active. When the bot's chest slot becomes empty, it now performs the following actions: - Sends a Discord notification to inform the user that it has run out of elytras. - Disconnects from the server with the message "Ran out of elytras." - Stops the ElytraController and deactivates the BaseFinder module. This prevents the bot from falling to its death and ensures the user is alerted to the situation. --- .../basefinder/modules/BaseFinderModule.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/main/java/com/baseminer/basefinder/modules/BaseFinderModule.java b/src/main/java/com/baseminer/basefinder/modules/BaseFinderModule.java index ccef396..e22d33d 100644 --- a/src/main/java/com/baseminer/basefinder/modules/BaseFinderModule.java +++ b/src/main/java/com/baseminer/basefinder/modules/BaseFinderModule.java @@ -14,7 +14,9 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.entity.EquipmentSlot; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; import net.minecraft.world.chunk.Chunk; @@ -238,6 +240,29 @@ private void onTick(TickEvent.Post event) { return; } + // Elytra check + if (ElytraController.isActive() && mc.player.getEquippedStack(EquipmentSlot.CHEST).isEmpty()) { + // Send Discord notification + DiscordEmbed embed = new DiscordEmbed( + "Out of Elytras!", + "The bot has run out of elytras and will now disconnect.", + 0xFF0000 + ); + DiscordWebhook.sendMessage("@everyone", embed); + + // Disconnect from server + if (mc.getNetworkHandler() != null) { + mc.getNetworkHandler().getConnection().disconnect(Text.of("Ran out of elytras.")); + } + + // Stop elytra controller + ElytraController.stop(); + + // Deactivate the module + toggle(); + return; // Stop further processing in onTick + } + // Death detection - check if player health dropped to 0 or respawned if (notifyOnDeath.get()) { float currentHealth = mc.player.getHealth();