- Status
- Offline
- Joined
- Jul 18, 2023
- Messages
- 707
- Reaction score
- 3
Welcome, esteemed builders and fearless adventurers, to an expansive sanctuary of boundless Minecraft resources that are poised to revolutionize your gameplay like never before! Prepare to be engulfed in a treasure trove of meticulously curated mods, skins, and an array of other exciting elements, all expertly crafted with the sole purpose of elevating your gaming experience to unprecedented heights.
In this wondrous realm of pixels and creativity, you are invited to immerse yourself fully and uncover an extensive selection that caters to your every desire. Whether your heart yearns to construct awe-inspiring structures that defy the laws of physics or embark on daring quests that push the boundaries of your abilities, we have thoughtfully curated a diverse collection that is sure to meet and exceed your every need.
The possibilities are truly limitless, and your imagination will know no bounds as you venture forth into this pixelated wonderland. Embrace the potential for unparalleled adventure and let your ingenuity soar to new heights as you unleash your creativity without any constraints.
In this wondrous realm of pixels and creativity, you are invited to immerse yourself fully and uncover an extensive selection that caters to your every desire. Whether your heart yearns to construct awe-inspiring structures that defy the laws of physics or embark on daring quests that push the boundaries of your abilities, we have thoughtfully curated a diverse collection that is sure to meet and exceed your every need.
The possibilities are truly limitless, and your imagination will know no bounds as you venture forth into this pixelated wonderland. Embrace the potential for unparalleled adventure and let your ingenuity soar to new heights as you unleash your creativity without any constraints.
AutoSoup:
JavaScript:
package fun.rich.client.feature.impl.world;
import net.minecraft.init.Items;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import fun.rich.client.event.EventTarget;
import fun.rich.client.event.events.impl.player.EventPreMotion;
import fun.rich.client.feature.Feature;
import fun.rich.client.feature.impl.FeatureCategory;
import fun.rich.client.ui.settings.impl.NumberSetting;
public class AutoSoup extends Feature {
private static final int HOTBAR_SIZE = 9;
private boolean isActive;
public static NumberSetting health;
private int lastSlot = -1;
public AutoSoup() {
super("AutoSoup", "Кушает mushroom stew при определенном хп", FeatureCategory.World);
health = new NumberSetting("Health Amount", 15, 1, 20, 1, () -> true);
addSettings(health);
}
@EventTarget
public void onUpdate(EventPreMotion eventUpdate) {
this.setSuffix("" + (int) health.getNumberValue());
if (mc.player == null || mc.world == null)
return;
int stewSlot = findStewInHotbar();
if (stewSlot == -1) {
// No stew in hotbar, check inventory
stewSlot = findStewInInventory();
if (stewSlot != -1) {
// Stew found in inventory, move it to hotbar
moveItemToHotbar(stewSlot);
}
}
ItemStack heldItem = mc.player.getHeldItemMainhand();
if (heldItem.getItem().isDamageable() && heldItem.getItemDamage() >= heldItem.getMaxDamage() - 5) {
// The currently held item is almost broken, switch to a new one
int newSlot = findStewInHotbar();
if (newSlot != -1) {
switchToSlot(newSlot);
}
}
if (mc.player.getHealth() <= health.getNumberValue()) {
isActive = true;
if (mc.player.getHeldItem(EnumHand.MAIN_HAND).getItem() == Items.MUSHROOM_STEW) {
mc.rightClickMouse();
} else if (stewSlot != -1) {
switchToSlot(stewSlot);
}
} else if (isActive) {
mc.playerController.onStoppedUsingItem(mc.player); // Stop using the current item
isActive = false;
if (lastSlot != -1) {
switchToSlot(lastSlot);
lastSlot = -1;
}
}
}
private int findStewInHotbar() {
for (int i = 0; i < HOTBAR_SIZE; i++) {
ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (stack.getItem() == Items.MUSHROOM_STEW) {
return i;
}
}
return -1;
}
private int findStewInInventory() {
for (int i = HOTBAR_SIZE; i < mc.player.inventory.getSizeInventory(); i++) {
ItemStack stack = mc.player.inventory.getStackInSlot(i);
if (stack.getItem() == Items.MUSHROOM_STEW) {
return i;
}
}
return -1;
}
private void moveItemToHotbar(int slot) {
if (slot < HOTBAR_SIZE) {
return;
}
int firstEmptyIndex = findFirstEmptyHotbarSlot();
if (firstEmptyIndex == -1) {
return;
}
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, firstEmptyIndex, 0, ClickType.PICKUP, mc.player);
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player);
}
private int findFirstEmptyHotbarSlot() {
for (int i = 0; i < HOTBAR_SIZE; i++) {
if (mc.player.inventory.getStackInSlot(i).isEmpty()) {
return i;
}
}
return -1;
}
private void switchSlots(int slot1, int slot2) {
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot1, 0, ClickType.PICKUP,
mc.player);
mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot2, 0, ClickType.PICKUP,
mc.player);
}
private void switchToSlot(int slot) {
if (lastSlot == -1 && mc.player.inventory.currentItem != slot) {
lastSlot = mc.player.inventory.currentItem;
}
mc.player.inventory.currentItem = slot;
}
}