use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class AutoBreed method onTick.
@EventHandler
private void onTick(TickEvent.Pre event) {
for (Entity entity : mc.world.getEntities()) {
AnimalEntity animal;
if (!(entity instanceof AnimalEntity))
continue;
else
animal = (AnimalEntity) entity;
if (!entities.get().getBoolean(animal.getType()) || (animal.isBaby() && !ignoreBabies.get()) || animalsFed.contains(animal) || mc.player.distanceTo(animal) > range.get() || !animal.isBreedingItem(hand.get() == Hand.Mainhand ? mc.player.getMainHandStack() : mc.player.getOffHandStack()))
continue;
Rotations.rotate(Rotations.getYaw(entity), Rotations.getPitch(entity), -100, () -> {
mc.interactionManager.interactEntity(mc.player, animal, hand.get().hand);
mc.player.swingHand(hand.get().hand);
animalsFed.add(animal);
});
return;
}
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class LiquidFiller method onTick.
@EventHandler
private void onTick(TickEvent.Pre event) {
// Update timer according to delay
if (timer < delay.get()) {
timer++;
return;
} else
timer = 0;
// Find slot with a block
FindItemResult item = InvUtils.findInHotbar(itemStack -> itemStack.getItem() instanceof BlockItem && whitelist.get().contains(Block.getBlockFromItem(itemStack.getItem())));
if (!item.found())
return;
// Loop blocks around the player
BlockIterator.register(horizontalRadius.get(), verticalRadius.get(), (blockPos, blockState) -> {
// Check if the block a source liquid block
if (isSource(blockState)) {
Block liquid = blockState.getBlock();
PlaceIn placeIn = placeInLiquids.get();
if (placeIn == PlaceIn.Both || (placeIn == PlaceIn.Lava && liquid == Blocks.LAVA) || (placeIn == PlaceIn.Water && liquid == Blocks.WATER)) {
if (BlockUtils.place(blockPos, item, rotate.get(), 0, true))
BlockIterator.disableCurrent();
}
}
});
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class NoobDetector method onTick.
@EventHandler
public void onTick(TickEvent.Post event) {
if (this.count >= 20) {
for (Entity entity : mc.world.getEntities()) {
if (entity.isAlive() && entity.distanceTo(mc.player) <= Modules.get().get(CrystalAura.class).targetRange.get() && entity != mc.player && PlayerUtils.isNoob(target)) {
isTargetANoob = true;
if (chat.get())
info("Your target is a noob!");
count = 0;
}
}
}
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class AnchorAura method onRender3D.
@EventHandler
private void onRender3D(Render3DEvent event) {
if (target == null)
return;
if (renderPlace.get()) {
BlockPos placePos = findPlacePos(target.getBlockPos());
if (placePos == null)
return;
event.renderer.box(placePos, placeSideColor.get(), placeLineColor.get(), shapeMode.get(), 0);
}
if (renderBreak.get()) {
BlockPos breakPos = findBreakPos(target.getBlockPos());
if (breakPos == null)
return;
event.renderer.box(breakPos, breakSideColor.get(), breakLineColor.get(), shapeMode.get(), 0);
}
if (renderAutomation.get() && target != null) {
if (sentBurrowMine)
event.renderer.box(target.getBlockPos(), breakSideColor.get(), breakLineColor.get(), shapeMode.get(), 0);
if (sentTrapMine)
event.renderer.box(target.getBlockPos().up(2), breakSideColor.get(), breakLineColor.get(), shapeMode.get(), 0);
}
}
use of mathax.client.eventbus.EventHandler in project Client by MatHax.
the class AnchorAura method onTick.
@EventHandler
private void onTick(TickEvent.Post event) {
if (mc.world.getDimension().isRespawnAnchorWorking()) {
error("You are in the Nether, disabling...");
toggle();
return;
}
if (PlayerUtils.shouldPause(pauseOnMine.get(), pauseOnEat.get(), pauseOnDrink.get()))
return;
if (EntityUtils.getTotalPlayerHealth(mc.player) <= minHealth.get())
return;
if (TargetUtils.isBadTarget(target, targetRange.get()))
target = TargetUtils.getPlayerTarget(targetRange.get(), targetPriority.get());
if (TargetUtils.isBadTarget(target, targetRange.get()))
return;
FindItemResult anchor = InvUtils.findInHotbar(Items.RESPAWN_ANCHOR);
FindItemResult glowStone = InvUtils.findInHotbar(Items.GLOWSTONE);
if (!anchor.found() || !glowStone.found())
return;
if (antiStuck.get() && !sentAntiStuck) {
if (findBreakPos(target.getBlockPos()) == null && findPlacePos(target.getBlockPos()) == null && BlockUtils.getBlock(target.getBlockPos().up(2)) == Blocks.GLOWSTONE) {
FindItemResult pick = InvUtils.findPick();
if (pick.found()) {
InvUtils.updateSlot(pick.slot());
PlayerUtils.doPacketMine(target.getBlockPos().up(2));
sentAntiStuck = true;
return;
}
}
}
if (sentAntiStuck && BlockUtils.getBlock(target.getBlockPos().up(2)) != Blocks.GLOWSTONE)
sentAntiStuck = false;
if (breakSelfTrap.get() && !sentTrapMine) {
if (findBreakPos(target.getBlockPos()) == null && findPlacePos(target.getBlockPos()) == null && BlockUtils.isTrapBlock(target.getBlockPos().up(2))) {
FindItemResult pick = InvUtils.findPick();
if (pick.found()) {
InvUtils.updateSlot(pick.slot());
info("Breaking (highlight)%s(default)'s self-trap.", target.getEntityName());
PlayerUtils.doPacketMine(target.getBlockPos().up(2));
sentTrapMine = true;
return;
}
}
}
if (sentTrapMine && !BlockUtils.isTrapBlock(target.getBlockPos().up(2))) {
if (fastPlaceAfter.get()) {
placeDelayLeft = 0;
breakDelayLeft = 0;
}
sentTrapMine = false;
}
if (breakBurrow.get() && !sentBurrowMine && PlayerUtils.isBurrowed(target, true)) {
FindItemResult pick = InvUtils.findPick();
if (pick.found()) {
InvUtils.updateSlot(pick.slot());
info("Breaking (highlight)%s(default)'s burrow.", target.getEntityName());
PlayerUtils.doPacketMine(target.getBlockPos());
sentBurrowMine = true;
return;
}
}
if (sentBurrowMine && PlayerUtils.isBurrowed(target, true))
return;
else
sentBurrowMine = false;
if (breakDelayLeft >= breakDelay.get()) {
BlockPos breakPos = findBreakPos(target.getBlockPos());
if (breakPos != null) {
breakDelayLeft = 0;
if (rotationMode.get() == RotationMode.Both || rotationMode.get() == RotationMode.Break)
Rotations.rotate(Rotations.getYaw(breakPos), Rotations.getPitch(breakPos), 50, () -> breakAnchor(breakPos, anchor, glowStone));
else
breakAnchor(breakPos, anchor, glowStone);
}
}
if (placeDelayLeft >= placeDelay.get() && place.get()) {
BlockPos placePos = findPlacePos(target.getBlockPos());
if (placePos != null) {
placeDelayLeft = 0;
BlockUtils.place(placePos, anchor, (rotationMode.get() == RotationMode.Place || rotationMode.get() == RotationMode.Both), 50);
}
}
placeDelayLeft++;
breakDelayLeft++;
}
Aggregations