Snale rewrite = Addon rewrite

Downgraded to v0.4.4 meteor due to meteor 1.17 being too instable.

Snale rewrote InvUtils so I had to fix all of these >:|
This commit is contained in:
StormyBytes
2021-06-07 05:01:46 +07:00
parent 85e74af939
commit 7b15b78029
16 changed files with 102 additions and 195 deletions

View File

@@ -27,7 +27,7 @@ dependencies {
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs. // PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them. // You may need to force-disable transitiveness on them.
modImplementation "com.github.MeteorDevelopment:meteor-client:master" modImplementation "com.github.MeteorDevelopment:meteor-client:v0.4.4"
} }
processResources { processResources {

View File

@@ -53,7 +53,6 @@ public class MeteorRejectsAddon extends MeteorAddon {
Commands commands = Commands.get(); Commands commands = Commands.get();
commands.add(new AntiAntiXrayCommand()); commands.add(new AntiAntiXrayCommand());
commands.add(new BookDupeCommand());
commands.add(new GiveCommand()); commands.add(new GiveCommand());
commands.add(new SaveSkinCommand()); commands.add(new SaveSkinCommand());
commands.add(new ServerCommand()); commands.add(new ServerCommand());

View File

@@ -1,59 +0,0 @@
package cloudburst.rejects.commands;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.exceptions.SimpleCommandExceptionType;
import minegame159.meteorclient.systems.commands.Command;
import minegame159.meteorclient.utils.player.InvUtils;
import net.minecraft.command.CommandSource;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.StringTag;
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
import net.minecraft.text.LiteralText;
import net.minecraft.util.Hand;
import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
//Credit to the original author (https://github.com/Gaider10/BookDupe) (i think) for some of this code.
public class BookDupeCommand extends Command {
private final ItemStack DUPE_BOOK = new ItemStack(Items.WRITABLE_BOOK, 1);
private final static SimpleCommandExceptionType NO_BOOK_EXCEPTION = new SimpleCommandExceptionType(new LiteralText("No book found"));
public BookDupeCommand() {
super("dupe", "Dupes using a held, writable book.");
StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < 21845; i++){
stringBuilder.append((char) 2048);
}
String str1 = stringBuilder.toString();
ListTag listTag = new ListTag();
listTag.addTag(0, StringTag.of(str1));
for(int i = 1; i < 40; i++){
listTag.addTag(i, StringTag.of("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
}
DUPE_BOOK.putSubTag("title", StringTag.of("a"));
DUPE_BOOK.putSubTag("pages", listTag);
}
@Override
public void build(LiteralArgumentBuilder<CommandSource> builder) {
builder.executes(context -> {
if (InvUtils.getHand(Items.WRITABLE_BOOK) != Hand.MAIN_HAND) throw NO_BOOK_EXCEPTION.create();
mc.player.networkHandler.sendPacket(new BookUpdateC2SPacket(DUPE_BOOK, true, mc.player.inventory.selectedSlot));
return SINGLE_SUCCESS;
});
}
}

View File

@@ -41,8 +41,8 @@ public class AppleHud extends HudElement {
if (isInEditor()) { if (isInEditor()) {
RenderUtils.drawItem(Items.GOLDEN_APPLE.getDefaultStack(), (int) x, (int) y, scale.get(), true); RenderUtils.drawItem(Items.GOLDEN_APPLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
} else { } else {
int count = InvUtils.findItemWithCount(Items.GOLDEN_APPLE).count; int count = InvUtils.find(Items.GOLDEN_APPLE).count;
count += InvUtils.findItemWithCount(Items.ENCHANTED_GOLDEN_APPLE).count; count += InvUtils.find(Items.ENCHANTED_GOLDEN_APPLE).count;
if (count > 0) if (count > 0)
RenderUtils.drawItem(new ItemStack(Items.GOLDEN_APPLE, count), (int) x, (int) y, scale.get(), true); RenderUtils.drawItem(new ItemStack(Items.GOLDEN_APPLE, count), (int) x, (int) y, scale.get(), true);
} }

View File

@@ -42,8 +42,8 @@ public class CrystalHud extends HudElement {
if (isInEditor()) { if (isInEditor()) {
RenderUtils.drawItem(Items.END_CRYSTAL.getDefaultStack(), (int) x, (int) y, scale.get(), true); RenderUtils.drawItem(Items.END_CRYSTAL.getDefaultStack(), (int) x, (int) y, scale.get(), true);
} else if (InvUtils.findItemWithCount(Items.END_CRYSTAL).count > 0) { } else if (InvUtils.find(Items.END_CRYSTAL).count > 0) {
RenderUtils.drawItem(new ItemStack(Items.END_CRYSTAL, InvUtils.findItemWithCount(Items.END_CRYSTAL).count), (int) x, (int) y, scale.get(), true); RenderUtils.drawItem(new ItemStack(Items.END_CRYSTAL, InvUtils.find(Items.END_CRYSTAL).count), (int) x, (int) y, scale.get(), true);
} }
} }
} }

View File

@@ -40,8 +40,8 @@ public class ExpHud extends HudElement {
if (isInEditor()) { if (isInEditor()) {
RenderUtils.drawItem(Items.EXPERIENCE_BOTTLE.getDefaultStack(), (int) x, (int) y, scale.get(), true); RenderUtils.drawItem(Items.EXPERIENCE_BOTTLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
} else if (InvUtils.findItemWithCount(Items.EXPERIENCE_BOTTLE).count > 0) { } else if (InvUtils.find(Items.EXPERIENCE_BOTTLE).count > 0) {
RenderUtils.drawItem(new ItemStack(Items.EXPERIENCE_BOTTLE, InvUtils.findItemWithCount(Items.EXPERIENCE_BOTTLE).count), (int) x, (int) y, scale.get(), true); RenderUtils.drawItem(new ItemStack(Items.EXPERIENCE_BOTTLE, InvUtils.find(Items.EXPERIENCE_BOTTLE).count), (int) x, (int) y, scale.get(), true);
} }
} }
} }

View File

@@ -103,9 +103,9 @@ public class Auto32K extends Module {
private void onTick(TickEvent.Post event) { private void onTick(TickEvent.Post event) {
if (phase <= 7) { if (phase <= 7) {
if (mode.get() == Mode.Hopper) { if (mode.get() == Mode.Hopper) {
int shulkerSlot = InvUtils.findItemWithCount(Items.SHULKER_BOX).slot; FindItemResult findShulker = InvUtils.findInHotbar(Items.SHULKER_BOX);
int hopperSlot = InvUtils.findItemWithCount(Items.HOPPER).slot; FindItemResult findHopper = InvUtils.findInHotbar(Items.HOPPER);
if (isValidSlot(shulkerSlot) || isValidSlot(hopperSlot)) return; if (isValidSlot(findShulker) || isValidSlot(findHopper)) return;
List<BlockPos> sortedBlocks = findValidBlocksHopper(); List<BlockPos> sortedBlocks = findValidBlocksHopper();
sortedBlocks.sort(Comparator.comparingDouble(value -> mc.player.squaredDistanceTo(value.getX(), value.getY(), value.getZ()))); sortedBlocks.sort(Comparator.comparingDouble(value -> mc.player.squaredDistanceTo(value.getX(), value.getY(), value.getZ())));
Iterator<BlockPos> sortedIterator = sortedBlocks.iterator(); Iterator<BlockPos> sortedIterator = sortedBlocks.iterator();
@@ -113,13 +113,13 @@ public class Auto32K extends Module {
if(sortedIterator.hasNext()) bestBlock = sortedIterator.next(); if(sortedIterator.hasNext()) bestBlock = sortedIterator.next();
if (bestBlock != null) { if (bestBlock != null) {
while (!BlockUtils.place(bestBlock, Hand.MAIN_HAND,hopperSlot,true,100,false)) { while (!BlockUtils.place(bestBlock, findHopper,true,100,false)) {
if(sortedIterator.hasNext()) { if(sortedIterator.hasNext()) {
bestBlock = sortedIterator.next().up(); bestBlock = sortedIterator.next().up();
}else break; }else break;
} }
mc.player.setSneaking(true); mc.player.setSneaking(true);
if (!BlockUtils.place(bestBlock.up(), Hand.MAIN_HAND, shulkerSlot,true,100,false)) { if (!BlockUtils.place(bestBlock.up(), findShulker,true,100,false)) {
error("Failed to place."); error("Failed to place.");
this.toggle(); this.toggle();
return; return;
@@ -129,23 +129,23 @@ public class Auto32K extends Module {
phase = 8; phase = 8;
} }
} else if (mode.get() == Mode.Dispenser) { } else if (mode.get() == Mode.Dispenser) {
int shulkerSlot = InvUtils.findItemWithCount(Items.SHULKER_BOX).slot; FindItemResult shulkerSlot = InvUtils.find(Items.SHULKER_BOX);
int hopperSlot = InvUtils.findItemWithCount(Items.HOPPER).slot; FindItemResult hopperSlot = InvUtils.find(Items.HOPPER);
int dispenserSlot = InvUtils.findItemWithCount(Items.DISPENSER).slot; FindItemResult dispenserSlot = InvUtils.find(Items.DISPENSER);
int redstoneSlot = InvUtils.findItemWithCount(Items.REDSTONE_BLOCK).slot; FindItemResult redstoneSlot = InvUtils.find(Items.REDSTONE_BLOCK);
if ((isValidSlot(shulkerSlot) && mode.get() == Mode.Hopper) || isValidSlot(hopperSlot) || isValidSlot(dispenserSlot) || isValidSlot(redstoneSlot)) if ((isValidSlot(shulkerSlot) && mode.get() == Mode.Hopper) || isValidSlot(hopperSlot) || isValidSlot(dispenserSlot) || isValidSlot(redstoneSlot))
return; return;
if (phase == 0) { if (phase == 0) {
bestBlock = findValidBlocksDispenser(); bestBlock = findValidBlocksDispenser();
if(bestBlock == null) return; if(bestBlock == null) return;
if (!BlockUtils.place(bestBlock.add(x, 0, z), Hand.MAIN_HAND, hopperSlot, true, 100, false)) { if (!BlockUtils.place(bestBlock.add(x, 0, z), hopperSlot, true, 100, false)) {
error("Failed to place."); error("Failed to place.");
this.toggle(); this.toggle();
return; return;
} }
phase += 1; phase += 1;
} else if (phase == 1) { } else if (phase == 1) {
mc.player.inventory.selectedSlot = dispenserSlot; mc.player.inventory.selectedSlot = dispenserSlot.slot;
if (x == -1) { if (x == -1) {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(-90f, mc.player.pitch, mc.player.isOnGround())); mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(-90f, mc.player.pitch, mc.player.isOnGround()));
} else if (x == 1) { } else if (x == 1) {
@@ -164,13 +164,13 @@ public class Auto32K extends Module {
phase += 1; phase += 1;
}else if (phase == 4 && mc.currentScreen instanceof Generic3x3ContainerScreen) { }else if (phase == 4 && mc.currentScreen instanceof Generic3x3ContainerScreen) {
mc.player.getSpeed(); mc.player.getSpeed();
InvUtils.move().from(shulkerSlot).toId(4); InvUtils.move().from(shulkerSlot.slot).toId(4);
phase += 1; phase += 1;
}else if (phase == 5 && mc.currentScreen instanceof Generic3x3ContainerScreen) { }else if (phase == 5 && mc.currentScreen instanceof Generic3x3ContainerScreen) {
mc.player.closeHandledScreen(); mc.player.closeHandledScreen();
phase += 1; phase += 1;
}else if (phase == 6) { }else if (phase == 6) {
mc.player.inventory.selectedSlot = redstoneSlot; mc.player.inventory.selectedSlot = redstoneSlot.slot;
mc.player.setSneaking(true); mc.player.setSneaking(true);
mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), mc.player.getHorizontalFacing().getOpposite(), bestBlock.up(2), false)); mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(mc.player.getPos(), mc.player.getHorizontalFacing().getOpposite(), bestBlock.up(2), false));
mc.player.setSneaking(false); mc.player.setSneaking(false);
@@ -295,8 +295,8 @@ public class Auto32K extends Module {
return allBlocks; return allBlocks;
} }
private boolean isValidSlot(int slot){ private boolean isValidSlot(FindItemResult findItemResult){
return slot == -1 || slot >= 9; return findItemResult.slot == -1 || findItemResult.slot >= 9;
} }
private List<Block> setDefaultBlocks(){ private List<Block> setDefaultBlocks(){

View File

@@ -1,8 +1,5 @@
package cloudburst.rejects.modules; package cloudburst.rejects.modules;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import cloudburst.rejects.MeteorRejectsAddon; import cloudburst.rejects.MeteorRejectsAddon;
import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.world.TickEvent; import minegame159.meteorclient.events.world.TickEvent;
@@ -11,16 +8,15 @@ import minegame159.meteorclient.settings.IntSetting;
import minegame159.meteorclient.settings.Setting; import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup; import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Module; import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.world.BlockUtils; import minegame159.meteorclient.utils.world.BlockUtils;
import org.lwjgl.system.CallbackI.P;
import net.minecraft.block.BedBlock; import net.minecraft.block.BedBlock;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.HitResult; import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
public class AutoBedTrap extends Module { public class AutoBedTrap extends Module {
@@ -95,14 +91,14 @@ public class AutoBedTrap extends Module {
return; return;
} }
int block_slot = InvUtils.findItemInHotbar(Items.OBSIDIAN); FindItemResult findBlock = InvUtils.findInHotbar(Items.OBSIDIAN);
if (block_slot == -1) { if (findBlock.slot == -1) {
error("No specified blocks found. Disabling."); error("No specified blocks found. Disabling.");
toggle(); toggle();
} }
if (BlockUtils.place(b, Hand.MAIN_HAND, block_slot, rotate.get(), 10, false)) { if (BlockUtils.place(b, findBlock, rotate.get(), 10, false)) {
cap++; cap++;
if (cap >= bpt.get()) { if (cap >= bpt.get()) {
return; return;

View File

@@ -9,7 +9,7 @@ import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup; import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Module; import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.PlayerUtils; import minegame159.meteorclient.utils.player.PlayerUtils;
import minegame159.meteorclient.utils.player.RotationUtils; import minegame159.meteorclient.utils.player.Rotations;
import minegame159.meteorclient.utils.world.BlockIterator; import minegame159.meteorclient.utils.world.BlockIterator;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.effect.StatusEffect; import net.minecraft.entity.effect.StatusEffect;
@@ -123,12 +123,12 @@ public class AutoExtinguish extends Module {
if (center.get()) { if (center.get()) {
PlayerUtils.centerPlayer(); PlayerUtils.centerPlayer();
} }
RotationUtils.packetRotate(yaw, 90); Rotations.rotate(yaw, 90);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP)); mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
mc.player.swingHand(Hand.MAIN_HAND); mc.player.swingHand(Hand.MAIN_HAND);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP)); mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP));
RotationUtils.packetRotate(yaw, pitch); Rotations.rotate(yaw, pitch);
} }
place(slot); place(slot);
hasPlacedWater = true; hasPlacedWater = true;
@@ -158,10 +158,10 @@ public class AutoExtinguish extends Module {
float yaw = mc.gameRenderer.getCamera().getYaw() % 360; float yaw = mc.gameRenderer.getCamera().getYaw() % 360;
float pitch = mc.gameRenderer.getCamera().getPitch() % 360; float pitch = mc.gameRenderer.getCamera().getPitch() % 360;
RotationUtils.packetRotate(yaw, 90); Rotations.rotate(yaw, 90);
mc.interactionManager.interactItem(mc.player, mc.player.world, Hand.MAIN_HAND); mc.interactionManager.interactItem(mc.player, mc.player.world, Hand.MAIN_HAND);
mc.player.inventory.selectedSlot = preSlot; mc.player.inventory.selectedSlot = preSlot;
RotationUtils.packetRotate(yaw, pitch); Rotations.rotate(yaw, pitch);
} }
} }

View File

@@ -3,22 +3,18 @@ package cloudburst.rejects.modules;
import cloudburst.rejects.MeteorRejectsAddon; import cloudburst.rejects.MeteorRejectsAddon;
import meteordevelopment.orbit.EventHandler; import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.world.TickEvent; import minegame159.meteorclient.events.world.TickEvent;
import minegame159.meteorclient.systems.modules.Categories;
import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.settings.BoolSetting; import minegame159.meteorclient.settings.BoolSetting;
import minegame159.meteorclient.settings.IntSetting; import minegame159.meteorclient.settings.IntSetting;
import minegame159.meteorclient.settings.Setting; import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup; import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.world.BlockUtils; import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
public class AutoHighway extends Module { public class AutoHighway extends Module {
@@ -83,7 +79,7 @@ public class AutoHighway extends Module {
return; return;
} }
// Check Obsidian // Check Obsidian
if(InvUtils.findItemInHotbar(Items.OBSIDIAN) == -1) return; if(!InvUtils.findInHotbar(Items.OBSIDIAN).found()) return;
// Get Size // Get Size
highwaySize = getSize(); highwaySize = getSize();
// Place // Place
@@ -576,8 +572,8 @@ public class AutoHighway extends Module {
if (!blockState.getMaterial().isReplaceable()) return true; if (!blockState.getMaterial().isReplaceable()) return true;
int slot = findSlot(); FindItemResult slot = InvUtils.find(Items.OBSIDIAN);
if (BlockUtils.place(placePos, Hand.MAIN_HAND, slot, rotate.get(), 10, true)) { if (BlockUtils.place(placePos, slot, rotate.get(), 10, true)) {
return_ = true; return_ = true;
} }
@@ -632,22 +628,4 @@ public class AutoHighway extends Module {
if(yaw >= 112.5 && yaw < 157.5) return Direction.WEST_NORTH; if(yaw >= 112.5 && yaw < 157.5) return Direction.WEST_NORTH;
return Direction.SOUTH; return Direction.SOUTH;
} }
private int findSlot() {
for (int i = 0; i < 9; i++) {
Item item = mc.player.inventory.getStack(i).getItem();
if (!(item instanceof BlockItem)) continue;
if (item == Items.OBSIDIAN) {
return i;
}
}
return -1;
}
} }

View File

@@ -9,6 +9,7 @@ import minegame159.meteorclient.settings.IntSetting;
import minegame159.meteorclient.settings.Setting; import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup; import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Module; import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.player.PlayerUtils; import minegame159.meteorclient.utils.player.PlayerUtils;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
@@ -60,7 +61,8 @@ public class AutoTNT extends Module {
private final ArrayList<BlockPos> blocks = new ArrayList<>(); private final ArrayList<BlockPos> blocks = new ArrayList<>();
private boolean ignited; private boolean ignited;
private int ticks = 0; private int ticks = 0;
private int preSlot, slot; private int preSlot;
private FindItemResult findSlot;
public AutoTNT() { public AutoTNT() {
super(MeteorRejectsAddon.CATEGORY, "auto-tnt", "Ignites TNT for you"); super(MeteorRejectsAddon.CATEGORY, "auto-tnt", "Ignites TNT for you");
@@ -104,25 +106,25 @@ public class AutoTNT extends Module {
blocks.sort(Comparator.comparingDouble(PlayerUtils::distanceTo)); blocks.sort(Comparator.comparingDouble(PlayerUtils::distanceTo));
// Get slot // Get slot
slot = getFlintAndSteelSlot(); findSlot = getFlintAndSteelSlot();
if (slot == -1) { if (!findSlot.found()) {
error("No flint and steel in hotbar"); error("No flint and steel in hotbar");
toggle(); toggle();
return; return;
} }
// Ignition // Ignition
ignite(blocks.get(0), slot); ignite(blocks.get(0), findSlot);
// Reset ticks // Reset ticks
ticks = delay.get(); ticks = delay.get();
} else ticks--; } else ticks--;
} }
private void ignite(BlockPos pos, int slot) { private void ignite(BlockPos pos, FindItemResult item) {
// Set slots // Set slots
preSlot = mc.player.inventory.selectedSlot; preSlot = mc.player.inventory.selectedSlot;
mc.player.inventory.selectedSlot = slot; mc.player.inventory.selectedSlot = item.slot;
ActionResult result = mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), Direction.UP, pos, true)); ActionResult result = mc.interactionManager.interactBlock(mc.player, mc.world, Hand.MAIN_HAND, new BlockHitResult(new Vec3d(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5), Direction.UP, pos, true));
@@ -133,7 +135,7 @@ public class AutoTNT extends Module {
mc.player.inventory.selectedSlot = preSlot; mc.player.inventory.selectedSlot = preSlot;
} }
private int getFlintAndSteelSlot() { private FindItemResult getFlintAndSteelSlot() {
return InvUtils.findItemInHotbar(item -> item.getItem() instanceof FlintAndSteelItem && (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10)); return InvUtils.findInHotbar(item -> item.getItem() instanceof FlintAndSteelItem && (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10));
} }
} }

View File

@@ -7,12 +7,12 @@ import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup; import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Categories; import minegame159.meteorclient.systems.modules.Categories;
import minegame159.meteorclient.systems.modules.Module; import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.player.PlayerUtils; import minegame159.meteorclient.utils.player.PlayerUtils;
import minegame159.meteorclient.utils.world.BlockUtils; import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
@@ -70,8 +70,8 @@ public class AutoWither extends Module {
} }
private boolean hasEnoughMaterials() { private boolean hasEnoughMaterials() {
if ((InvUtils.findItemWithCount(Items.SOUL_SAND).count < 4 && InvUtils.findItemWithCount(Items.SOUL_SOIL).count < 4) || if ((InvUtils.find(Items.SOUL_SAND).count < 4 && InvUtils.find(Items.SOUL_SOIL).count < 4) ||
InvUtils.findItemWithCount(Items.WITHER_SKELETON_SKULL).count < 3) InvUtils.find(Items.WITHER_SKELETON_SKULL).count < 3)
return false; return false;
return true; return true;
@@ -118,30 +118,30 @@ public class AutoWither extends Module {
private void spawnWither(BlockPos blockPos, Direction direction) { private void spawnWither(BlockPos blockPos, Direction direction) {
// Soul sand/soil slot // Soul sand/soil slot
int soulSlot = InvUtils.findItemInHotbar(Items.SOUL_SAND); FindItemResult findSoulSand = InvUtils.findInHotbar(Items.SOUL_SAND);
if (soulSlot == -1) InvUtils.findItemInHotbar(Items.SOUL_SOIL); if (!findSoulSand.found()) InvUtils.findInHotbar(Items.SOUL_SOIL);
// Skull slot // Skull slot
int skullSlot = InvUtils.findItemInHotbar(Items.WITHER_SKELETON_SKULL); FindItemResult findWitherSkull = InvUtils.findInHotbar(Items.WITHER_SKELETON_SKULL);
BlockUtils.place(blockPos, Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true); BlockUtils.place(blockPos, findSoulSand, rotate.get(), -50, true);
BlockUtils.place(blockPos.up(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up(), findSoulSand, rotate.get(), -50, true);
if (direction == Direction.EAST || direction == Direction.WEST) { if (direction == Direction.EAST || direction == Direction.WEST) {
BlockUtils.place(blockPos.up().north(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().north(), findSoulSand, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().south(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().south(), findSoulSand, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().up(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().north(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().up().north(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().south(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().up().south(), findWitherSkull, rotate.get(), -50, true);
} }
else if (direction == Direction.NORTH || direction == Direction.SOUTH) { else if (direction == Direction.NORTH || direction == Direction.SOUTH) {
BlockUtils.place(blockPos.up().east(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().east(), findSoulSand, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().west(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().west(), findSoulSand, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().up(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().east(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().up().east(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().west(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true); BlockUtils.place(blockPos.up().up().west(), findWitherSkull, rotate.get(), -50, true);
} }
} }
} }

View File

@@ -10,6 +10,7 @@ import minegame159.meteorclient.rendering.ShapeMode;
import minegame159.meteorclient.settings.IntSetting; import minegame159.meteorclient.settings.IntSetting;
import minegame159.meteorclient.settings.Setting; import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup; import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.player.Rotations; import minegame159.meteorclient.utils.player.Rotations;
import minegame159.meteorclient.utils.render.color.SettingColor; import minegame159.meteorclient.utils.render.color.SettingColor;
@@ -199,40 +200,40 @@ public class Lavacast extends Module {
} }
private void placeLava() { private void placeLava() {
int slot = InvUtils.findItemInHotbar(Items.LAVA_BUCKET); FindItemResult findItemResult = InvUtils.findInHotbar(Items.LAVA_BUCKET);
if (slot == -1) { if (!findItemResult.found()) {
error("No lava bucket found."); error("No lava bucket found.");
toggle(); toggle();
return; return;
} }
int prevSlot = mc.player.inventory.selectedSlot; int prevSlot = mc.player.inventory.selectedSlot;
mc.player.inventory.selectedSlot = slot; mc.player.inventory.selectedSlot = findItemResult.slot;
mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND); mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND);
mc.player.inventory.selectedSlot = prevSlot; mc.player.inventory.selectedSlot = prevSlot;
} }
private void placeWater() { private void placeWater() {
int slot = InvUtils.findItemInHotbar(Items.WATER_BUCKET); FindItemResult findItemResult = InvUtils.findInHotbar(Items.WATER_BUCKET);
if (slot == -1) { if (!findItemResult.found()) {
error("No water bucket found."); error("No water bucket found.");
toggle(); toggle();
return; return;
} }
int prevSlot = mc.player.inventory.selectedSlot; int prevSlot = mc.player.inventory.selectedSlot;
mc.player.inventory.selectedSlot = slot; mc.player.inventory.selectedSlot = findItemResult.slot;
mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND); mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND);
mc.player.inventory.selectedSlot = prevSlot; mc.player.inventory.selectedSlot = prevSlot;
} }
private void pickupLiquid() { private void pickupLiquid() {
int slot = InvUtils.findItemInHotbar(Items.BUCKET); FindItemResult findItemResult = InvUtils.findInHotbar(Items.BUCKET);
if (slot == -1) { if (!findItemResult.found()) {
error("No bucket found."); error("No bucket found.");
toggle(); toggle();
return; return;
} }
int prevSlot = mc.player.inventory.selectedSlot; int prevSlot = mc.player.inventory.selectedSlot;
mc.player.inventory.selectedSlot = slot; mc.player.inventory.selectedSlot = findItemResult.slot;
mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND); mc.interactionManager.interactItem(mc.player,mc.world,Hand.MAIN_HAND);
mc.player.inventory.selectedSlot = prevSlot; mc.player.inventory.selectedSlot = prevSlot;
} }

View File

@@ -6,12 +6,12 @@ import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.world.TickEvent; import minegame159.meteorclient.events.world.TickEvent;
import minegame159.meteorclient.settings.*; import minegame159.meteorclient.settings.*;
import minegame159.meteorclient.systems.modules.Module; import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.world.BlockUtils; import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import java.util.ArrayList; import java.util.ArrayList;
@@ -94,8 +94,8 @@ public class Painter extends Module {
else ticksWaited = 0; else ticksWaited = 0;
// Get slot // Get slot
int slot = findSlot(block.get()); FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> block.get() == Block.getBlockFromItem(itemStack.getItem()));
if (slot == -1) { if (findItemResult.slot == -1) {
error("No selected blocks in hotbar"); error("No selected blocks in hotbar");
toggle(); toggle();
return; return;
@@ -108,17 +108,13 @@ public class Painter extends Module {
// Place // Place
for (BlockPos blockPos : positions) { for (BlockPos blockPos : positions) {
BlockUtils.place(blockPos, Hand.MAIN_HAND, slot, rotate.get(), -100, false); BlockUtils.place(blockPos, findItemResult, rotate.get(), -100, false);
// Delay 0 // Delay 0
if (delay.get() != 0) break; if (delay.get() != 0) break;
} }
} }
private int findSlot(Block block) {
return InvUtils.findItemInHotbar(itemStack -> block == Block.getBlockFromItem(itemStack.getItem()));
}
private boolean shouldPlace(BlockPos blockPos, Block useBlock) { private boolean shouldPlace(BlockPos blockPos, Block useBlock) {
// Self // Self
if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) return false; if (!mc.world.getBlockState(blockPos).getMaterial().isReplaceable()) return false;

View File

@@ -6,12 +6,12 @@ import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.world.TickEvent; import minegame159.meteorclient.events.world.TickEvent;
import minegame159.meteorclient.settings.*; import minegame159.meteorclient.settings.*;
import minegame159.meteorclient.systems.modules.Module; import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils; import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.world.BlockUtils; import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.*; import net.minecraft.block.*;
import net.minecraft.block.enums.BlockHalf; import net.minecraft.block.enums.BlockHalf;
import net.minecraft.block.enums.SlabType; import net.minecraft.block.enums.SlabType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.minecraft.util.shape.VoxelShapes; import net.minecraft.util.shape.VoxelShapes;
@@ -87,8 +87,8 @@ public class SpawnProofer extends Module {
} }
// Find slot // Find slot
int slot = findSlot(); FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> blocks.get().contains(Block.getBlockFromItem(itemStack.getItem())));
if (slot == -1) { if (!findItemResult.found()) {
error("Found none of the chosen blocks in hotbar"); error("Found none of the chosen blocks in hotbar");
toggle(); toggle();
return; return;
@@ -105,12 +105,12 @@ public class SpawnProofer extends Module {
// Place the blocks // Place the blocks
if (delay.get() == 0) { if (delay.get() == 0) {
for (BlockPos blockPos : positions) BlockUtils.place(blockPos, Hand.MAIN_HAND, slot, rotate.get(), -50, false); for (BlockPos blockPos : positions) BlockUtils.place(blockPos, findItemResult, rotate.get(), -50, false);
} else { } else {
// If is light source // If is light source
if (isLightSource(Block.getBlockFromItem(mc.player.inventory.getStack(slot).getItem()))) { if (isLightSource(Block.getBlockFromItem(mc.player.inventory.getStack(findItemResult.slot).getItem()))) {
// Find lowest light level block // Find lowest light level block
int lowestLightLevel = 16; int lowestLightLevel = 16;
@@ -123,12 +123,12 @@ public class SpawnProofer extends Module {
selectedBlockPos = blockPos; selectedBlockPos = blockPos;
} }
} }
BlockUtils.place(selectedBlockPos, Hand.MAIN_HAND, slot, rotate.get(), -50, false); BlockUtils.place(selectedBlockPos, findItemResult, rotate.get(), -50, false);
} else { } else {
// Place first in positions // Place first in positions
BlockUtils.place(positions.get(0), Hand.MAIN_HAND, slot, rotate.get(), -50, false); BlockUtils.place(positions.get(0), findItemResult, rotate.get(), -50, false);
} }
} }
@@ -137,10 +137,6 @@ public class SpawnProofer extends Module {
ticksWaited = 0; ticksWaited = 0;
} }
private int findSlot() {
return InvUtils.findItemInHotbar(itemStack -> blocks.get().contains(Block.getBlockFromItem(itemStack.getItem())));
}
private boolean validSpawn(BlockPos blockPos) { // Copied from Light Overlay and modified slightly private boolean validSpawn(BlockPos blockPos) { // Copied from Light Overlay and modified slightly
BlockState blockState = mc.world.getBlockState(blockPos); BlockState blockState = mc.world.getBlockState(blockPos);

View File

@@ -1,38 +1,36 @@
package cloudburst.rejects.screens; package cloudburst.rejects.screens;
import java.awt.Point;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.function.Consumer;
import cloudburst.rejects.modules.InteractionMenu; import cloudburst.rejects.modules.InteractionMenu;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import minegame159.meteorclient.systems.modules.Modules; import minegame159.meteorclient.systems.modules.Modules;
import minegame159.meteorclient.utils.render.PeekScreen; import minegame159.meteorclient.utils.render.PeekScreen;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ChatScreen; import net.minecraft.client.gui.screen.ChatScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen;
import net.minecraft.client.options.KeyBinding; import net.minecraft.client.options.KeyBinding;
import net.minecraft.entity.*; import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.Saddleable;
import net.minecraft.entity.mob.EndermanEntity; import net.minecraft.entity.mob.EndermanEntity;
import net.minecraft.entity.passive.*; import net.minecraft.entity.passive.HorseBaseEntity;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.vehicle.StorageMinecartEntity; import net.minecraft.entity.vehicle.StorageMinecartEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import org.lwjgl.glfw.GLFW;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText; import net.minecraft.text.LiteralText;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.function.Consumer;
public class InteractionScreen extends Screen { public class InteractionScreen extends Screen {