use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.
the class Painter method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
// Tick delay
if (delay.get() != 0 && ticksWaited < delay.get() - 1) {
ticksWaited++;
return;
} else
ticksWaited = 0;
// Get slot
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> block.get() == Block.getBlockFromItem(itemStack.getItem()));
if (!findItemResult.found()) {
error("No selected blocks in hotbar");
toggle();
return;
}
// Find spots
for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
if (shouldPlace(blockPos, block.get()))
positions.add(blockPos);
}
// Place
for (BlockPos blockPos : positions) {
BlockUtils.place(blockPos, findItemResult, rotate.get(), -100, false);
// Delay 0
if (delay.get() != 0)
break;
}
}
use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.
the class AutoWither method onPostTick.
@EventHandler
private void onPostTick(TickEvent.Post event) {
if (wither == null) {
// Delay
if (witherTicksWaited < witherDelay.get() - 1) {
witherTicksWaited++;
return;
}
if (withers.isEmpty())
return;
// Sorting
switch(priority.get()) {
case Closest:
withers.sort(Comparator.comparingDouble(w -> PlayerUtils.distanceTo(w.foot)));
case Furthest:
withers.sort((w1, w2) -> {
int sort = Double.compare(PlayerUtils.distanceTo(w1.foot), PlayerUtils.distanceTo(w2.foot));
if (sort == 0)
return 0;
return sort > 0 ? -1 : 1;
});
case Random:
Collections.shuffle(withers);
}
wither = withers.get(0);
}
// Soul sand/soil and skull slot
FindItemResult findSoulSand = InvUtils.findInHotbar(Items.SOUL_SAND);
if (!findSoulSand.found())
findSoulSand = InvUtils.findInHotbar(Items.SOUL_SOIL);
FindItemResult findWitherSkull = InvUtils.findInHotbar(Items.WITHER_SKELETON_SKULL);
// Check for enough resources
if (!findSoulSand.found() || !findWitherSkull.found()) {
error("Not enough resources in hotbar");
toggle();
return;
}
// Build
if (blockDelay.get() == 0) {
// All in 1 tick
// Body
BlockUtils.place(wither.foot, findSoulSand, rotate.get(), -50);
BlockUtils.place(wither.foot.up(), findSoulSand, rotate.get(), -50);
BlockUtils.place(wither.foot.up().offset(wither.axis, -1), findSoulSand, rotate.get(), -50);
BlockUtils.place(wither.foot.up().offset(wither.axis, 1), findSoulSand, rotate.get(), -50);
// Head
BlockUtils.place(wither.foot.up().up(), findWitherSkull, rotate.get(), -50);
BlockUtils.place(wither.foot.up().up().offset(wither.axis, -1), findWitherSkull, rotate.get(), -50);
BlockUtils.place(wither.foot.up().up().offset(wither.axis, 1), findWitherSkull, rotate.get(), -50);
// Auto turnoff
if (turnOff.get()) {
wither = null;
toggle();
}
} else {
// Delay
if (blockTicksWaited < blockDelay.get() - 1) {
blockTicksWaited++;
return;
}
switch(wither.stage) {
case 0:
if (BlockUtils.place(wither.foot, findSoulSand, rotate.get(), -50))
wither.stage++;
break;
case 1:
if (BlockUtils.place(wither.foot.up(), findSoulSand, rotate.get(), -50))
wither.stage++;
break;
case 2:
if (BlockUtils.place(wither.foot.up().offset(wither.axis, -1), findSoulSand, rotate.get(), -50))
wither.stage++;
break;
case 3:
if (BlockUtils.place(wither.foot.up().offset(wither.axis, 1), findSoulSand, rotate.get(), -50))
wither.stage++;
break;
case 4:
if (BlockUtils.place(wither.foot.up().up(), findWitherSkull, rotate.get(), -50))
wither.stage++;
break;
case 5:
if (BlockUtils.place(wither.foot.up().up().offset(wither.axis, -1), findWitherSkull, rotate.get(), -50))
wither.stage++;
break;
case 6:
if (BlockUtils.place(wither.foot.up().up().offset(wither.axis, 1), findWitherSkull, rotate.get(), -50))
wither.stage++;
break;
case 7:
// Auto turnoff
if (turnOff.get()) {
wither = null;
toggle();
}
break;
}
}
witherTicksWaited = 0;
}
use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.
the class BlockIn method place.
private boolean place(int x, int y, int z) {
setBlockPos(x, y, z);
FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp));
if (!BlockUtils.canPlace(bp))
return true;
if (BlockUtils.place(bp, findItemResult, rotate.get(), 100, true)) {
return_ = true;
}
return false;
}
use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.
the class Lavacast method placeLava.
private void placeLava() {
FindItemResult findItemResult = InvUtils.findInHotbar(Items.LAVA_BUCKET);
if (!findItemResult.found()) {
error("No lava bucket found.");
toggle();
return;
}
int prevSlot = mc.player.getInventory().selectedSlot;
mc.player.getInventory().selectedSlot = findItemResult.slot();
mc.interactionManager.interactItem(mc.player, mc.world, Hand.MAIN_HAND);
mc.player.getInventory().selectedSlot = prevSlot;
}
use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.
the class Lavacast method pickupLiquid.
private void pickupLiquid() {
FindItemResult findItemResult = InvUtils.findInHotbar(Items.BUCKET);
if (!findItemResult.found()) {
error("No bucket found.");
toggle();
return;
}
int prevSlot = mc.player.getInventory().selectedSlot;
mc.player.getInventory().selectedSlot = findItemResult.slot();
mc.interactionManager.interactItem(mc.player, mc.world, Hand.MAIN_HAND);
mc.player.getInventory().selectedSlot = prevSlot;
}
Aggregations