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

@@ -53,7 +53,6 @@ public class MeteorRejectsAddon extends MeteorAddon {
Commands commands = Commands.get();
commands.add(new AntiAntiXrayCommand());
commands.add(new BookDupeCommand());
commands.add(new GiveCommand());
commands.add(new SaveSkinCommand());
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()) {
RenderUtils.drawItem(Items.GOLDEN_APPLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
} else {
int count = InvUtils.findItemWithCount(Items.GOLDEN_APPLE).count;
count += InvUtils.findItemWithCount(Items.ENCHANTED_GOLDEN_APPLE).count;
int count = InvUtils.find(Items.GOLDEN_APPLE).count;
count += InvUtils.find(Items.ENCHANTED_GOLDEN_APPLE).count;
if (count > 0)
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()) {
RenderUtils.drawItem(Items.END_CRYSTAL.getDefaultStack(), (int) x, (int) y, scale.get(), true);
} else if (InvUtils.findItemWithCount(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);
} else if (InvUtils.find(Items.END_CRYSTAL).count > 0) {
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()) {
RenderUtils.drawItem(Items.EXPERIENCE_BOTTLE.getDefaultStack(), (int) x, (int) y, scale.get(), true);
} else if (InvUtils.findItemWithCount(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);
} else if (InvUtils.find(Items.EXPERIENCE_BOTTLE).count > 0) {
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) {
if (phase <= 7) {
if (mode.get() == Mode.Hopper) {
int shulkerSlot = InvUtils.findItemWithCount(Items.SHULKER_BOX).slot;
int hopperSlot = InvUtils.findItemWithCount(Items.HOPPER).slot;
if (isValidSlot(shulkerSlot) || isValidSlot(hopperSlot)) return;
FindItemResult findShulker = InvUtils.findInHotbar(Items.SHULKER_BOX);
FindItemResult findHopper = InvUtils.findInHotbar(Items.HOPPER);
if (isValidSlot(findShulker) || isValidSlot(findHopper)) return;
List<BlockPos> sortedBlocks = findValidBlocksHopper();
sortedBlocks.sort(Comparator.comparingDouble(value -> mc.player.squaredDistanceTo(value.getX(), value.getY(), value.getZ())));
Iterator<BlockPos> sortedIterator = sortedBlocks.iterator();
@@ -113,13 +113,13 @@ public class Auto32K extends Module {
if(sortedIterator.hasNext()) bestBlock = sortedIterator.next();
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()) {
bestBlock = sortedIterator.next().up();
}else break;
}
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.");
this.toggle();
return;
@@ -129,23 +129,23 @@ public class Auto32K extends Module {
phase = 8;
}
} else if (mode.get() == Mode.Dispenser) {
int shulkerSlot = InvUtils.findItemWithCount(Items.SHULKER_BOX).slot;
int hopperSlot = InvUtils.findItemWithCount(Items.HOPPER).slot;
int dispenserSlot = InvUtils.findItemWithCount(Items.DISPENSER).slot;
int redstoneSlot = InvUtils.findItemWithCount(Items.REDSTONE_BLOCK).slot;
FindItemResult shulkerSlot = InvUtils.find(Items.SHULKER_BOX);
FindItemResult hopperSlot = InvUtils.find(Items.HOPPER);
FindItemResult dispenserSlot = InvUtils.find(Items.DISPENSER);
FindItemResult redstoneSlot = InvUtils.find(Items.REDSTONE_BLOCK);
if ((isValidSlot(shulkerSlot) && mode.get() == Mode.Hopper) || isValidSlot(hopperSlot) || isValidSlot(dispenserSlot) || isValidSlot(redstoneSlot))
return;
if (phase == 0) {
bestBlock = findValidBlocksDispenser();
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.");
this.toggle();
return;
}
phase += 1;
} else if (phase == 1) {
mc.player.inventory.selectedSlot = dispenserSlot;
mc.player.inventory.selectedSlot = dispenserSlot.slot;
if (x == -1) {
mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.LookOnly(-90f, mc.player.pitch, mc.player.isOnGround()));
} else if (x == 1) {
@@ -164,13 +164,13 @@ public class Auto32K extends Module {
phase += 1;
}else if (phase == 4 && mc.currentScreen instanceof Generic3x3ContainerScreen) {
mc.player.getSpeed();
InvUtils.move().from(shulkerSlot).toId(4);
InvUtils.move().from(shulkerSlot.slot).toId(4);
phase += 1;
}else if (phase == 5 && mc.currentScreen instanceof Generic3x3ContainerScreen) {
mc.player.closeHandledScreen();
phase += 1;
}else if (phase == 6) {
mc.player.inventory.selectedSlot = redstoneSlot;
mc.player.inventory.selectedSlot = redstoneSlot.slot;
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.player.setSneaking(false);
@@ -295,8 +295,8 @@ public class Auto32K extends Module {
return allBlocks;
}
private boolean isValidSlot(int slot){
return slot == -1 || slot >= 9;
private boolean isValidSlot(FindItemResult findItemResult){
return findItemResult.slot == -1 || findItemResult.slot >= 9;
}
private List<Block> setDefaultBlocks(){

View File

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

View File

@@ -9,7 +9,7 @@ import minegame159.meteorclient.settings.Setting;
import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.systems.modules.Module;
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 net.minecraft.block.Blocks;
import net.minecraft.entity.effect.StatusEffect;
@@ -123,12 +123,12 @@ public class AutoExtinguish extends Module {
if (center.get()) {
PlayerUtils.centerPlayer();
}
RotationUtils.packetRotate(yaw, 90);
Rotations.rotate(yaw, 90);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
mc.player.swingHand(Hand.MAIN_HAND);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP));
RotationUtils.packetRotate(yaw, pitch);
Rotations.rotate(yaw, pitch);
}
place(slot);
hasPlacedWater = true;
@@ -158,10 +158,10 @@ public class AutoExtinguish extends Module {
float yaw = mc.gameRenderer.getCamera().getYaw() % 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.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 meteordevelopment.orbit.EventHandler;
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.IntSetting;
import minegame159.meteorclient.settings.Setting;
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.world.BlockUtils;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
public class AutoHighway extends Module {
@@ -83,7 +79,7 @@ public class AutoHighway extends Module {
return;
}
// Check Obsidian
if(InvUtils.findItemInHotbar(Items.OBSIDIAN) == -1) return;
if(!InvUtils.findInHotbar(Items.OBSIDIAN).found()) return;
// Get Size
highwaySize = getSize();
// Place
@@ -576,8 +572,8 @@ public class AutoHighway extends Module {
if (!blockState.getMaterial().isReplaceable()) return true;
int slot = findSlot();
if (BlockUtils.place(placePos, Hand.MAIN_HAND, slot, rotate.get(), 10, true)) {
FindItemResult slot = InvUtils.find(Items.OBSIDIAN);
if (BlockUtils.place(placePos, slot, rotate.get(), 10, true)) {
return_ = true;
}
@@ -632,22 +628,4 @@ public class AutoHighway extends Module {
if(yaw >= 112.5 && yaw < 157.5) return Direction.WEST_NORTH;
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.SettingGroup;
import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.player.PlayerUtils;
import net.minecraft.block.Blocks;
@@ -60,7 +61,8 @@ public class AutoTNT extends Module {
private final ArrayList<BlockPos> blocks = new ArrayList<>();
private boolean ignited;
private int ticks = 0;
private int preSlot, slot;
private int preSlot;
private FindItemResult findSlot;
public AutoTNT() {
super(MeteorRejectsAddon.CATEGORY, "auto-tnt", "Ignites TNT for you");
@@ -104,25 +106,25 @@ public class AutoTNT extends Module {
blocks.sort(Comparator.comparingDouble(PlayerUtils::distanceTo));
// Get slot
slot = getFlintAndSteelSlot();
if (slot == -1) {
findSlot = getFlintAndSteelSlot();
if (!findSlot.found()) {
error("No flint and steel in hotbar");
toggle();
return;
}
// Ignition
ignite(blocks.get(0), slot);
ignite(blocks.get(0), findSlot);
// Reset ticks
ticks = delay.get();
} else ticks--;
}
private void ignite(BlockPos pos, int slot) {
private void ignite(BlockPos pos, FindItemResult item) {
// Set slots
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));
@@ -133,7 +135,7 @@ public class AutoTNT extends Module {
mc.player.inventory.selectedSlot = preSlot;
}
private int getFlintAndSteelSlot() {
return InvUtils.findItemInHotbar(item -> item.getItem() instanceof FlintAndSteelItem && (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10));
private FindItemResult getFlintAndSteelSlot() {
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.systems.modules.Categories;
import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.player.PlayerUtils;
import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.Blocks;
import net.minecraft.item.Items;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
@@ -70,8 +70,8 @@ public class AutoWither extends Module {
}
private boolean hasEnoughMaterials() {
if ((InvUtils.findItemWithCount(Items.SOUL_SAND).count < 4 && InvUtils.findItemWithCount(Items.SOUL_SOIL).count < 4) ||
InvUtils.findItemWithCount(Items.WITHER_SKELETON_SKULL).count < 3)
if ((InvUtils.find(Items.SOUL_SAND).count < 4 && InvUtils.find(Items.SOUL_SOIL).count < 4) ||
InvUtils.find(Items.WITHER_SKELETON_SKULL).count < 3)
return false;
return true;
@@ -118,30 +118,30 @@ public class AutoWither extends Module {
private void spawnWither(BlockPos blockPos, Direction direction) {
// Soul sand/soil slot
int soulSlot = InvUtils.findItemInHotbar(Items.SOUL_SAND);
if (soulSlot == -1) InvUtils.findItemInHotbar(Items.SOUL_SOIL);
FindItemResult findSoulSand = InvUtils.findInHotbar(Items.SOUL_SAND);
if (!findSoulSand.found()) InvUtils.findInHotbar(Items.SOUL_SOIL);
// 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.up(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos, findSoulSand, rotate.get(), -50, true);
BlockUtils.place(blockPos.up(), findSoulSand, rotate.get(), -50, true);
if (direction == Direction.EAST || direction == Direction.WEST) {
BlockUtils.place(blockPos.up().north(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().south(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().north(), findSoulSand, 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().north(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().south(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().north(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().south(), findWitherSkull, rotate.get(), -50, true);
}
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().west(), Hand.MAIN_HAND, soulSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().east(), findSoulSand, 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().east(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().west(), Hand.MAIN_HAND, skullSlot, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up(), findWitherSkull, rotate.get(), -50, true);
BlockUtils.place(blockPos.up().up().east(), findWitherSkull, 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.Setting;
import minegame159.meteorclient.settings.SettingGroup;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.player.Rotations;
import minegame159.meteorclient.utils.render.color.SettingColor;
@@ -199,40 +200,40 @@ public class Lavacast extends Module {
}
private void placeLava() {
int slot = InvUtils.findItemInHotbar(Items.LAVA_BUCKET);
if (slot == -1) {
FindItemResult findItemResult = InvUtils.findInHotbar(Items.LAVA_BUCKET);
if (!findItemResult.found()) {
error("No lava bucket found.");
toggle();
return;
}
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.player.inventory.selectedSlot = prevSlot;
}
private void placeWater() {
int slot = InvUtils.findItemInHotbar(Items.WATER_BUCKET);
if (slot == -1) {
FindItemResult findItemResult = InvUtils.findInHotbar(Items.WATER_BUCKET);
if (!findItemResult.found()) {
error("No water bucket found.");
toggle();
return;
}
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.player.inventory.selectedSlot = prevSlot;
}
private void pickupLiquid() {
int slot = InvUtils.findItemInHotbar(Items.BUCKET);
if (slot == -1) {
FindItemResult findItemResult = InvUtils.findInHotbar(Items.BUCKET);
if (!findItemResult.found()) {
error("No bucket found.");
toggle();
return;
}
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.player.inventory.selectedSlot = prevSlot;
}

View File

@@ -6,12 +6,12 @@ import meteordevelopment.orbit.EventHandler;
import minegame159.meteorclient.events.world.TickEvent;
import minegame159.meteorclient.settings.*;
import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import java.util.ArrayList;
@@ -94,8 +94,8 @@ public class Painter extends Module {
else ticksWaited = 0;
// Get slot
int slot = findSlot(block.get());
if (slot == -1) {
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> block.get() == Block.getBlockFromItem(itemStack.getItem()));
if (findItemResult.slot == -1) {
error("No selected blocks in hotbar");
toggle();
return;
@@ -108,17 +108,13 @@ public class Painter extends Module {
// Place
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
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) {
// Self
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.settings.*;
import minegame159.meteorclient.systems.modules.Module;
import minegame159.meteorclient.utils.player.FindItemResult;
import minegame159.meteorclient.utils.player.InvUtils;
import minegame159.meteorclient.utils.world.BlockUtils;
import net.minecraft.block.*;
import net.minecraft.block.enums.BlockHalf;
import net.minecraft.block.enums.SlabType;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.Registry;
import net.minecraft.util.shape.VoxelShapes;
@@ -87,8 +87,8 @@ public class SpawnProofer extends Module {
}
// Find slot
int slot = findSlot();
if (slot == -1) {
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> blocks.get().contains(Block.getBlockFromItem(itemStack.getItem())));
if (!findItemResult.found()) {
error("Found none of the chosen blocks in hotbar");
toggle();
return;
@@ -105,12 +105,12 @@ public class SpawnProofer extends Module {
// Place the blocks
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 {
// 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
int lowestLightLevel = 16;
@@ -123,12 +123,12 @@ public class SpawnProofer extends Module {
selectedBlockPos = blockPos;
}
}
BlockUtils.place(selectedBlockPos, Hand.MAIN_HAND, slot, rotate.get(), -50, false);
BlockUtils.place(selectedBlockPos, findItemResult, rotate.get(), -50, false);
} else {
// 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;
}
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
BlockState blockState = mc.world.getBlockState(blockPos);

View File

@@ -1,38 +1,36 @@
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 com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import minegame159.meteorclient.systems.modules.Modules;
import minegame159.meteorclient.utils.render.PeekScreen;
import net.minecraft.client.MinecraftClient;
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.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.passive.*;
import net.minecraft.entity.passive.HorseBaseEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.vehicle.StorageMinecartEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket;
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.util.Hand;
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 {
@@ -362,4 +360,4 @@ class Vector2 {
private float getMag() {
return (float) Math.sqrt(x * x + y * y);
}
}
}