use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.
the class CevBreaker method placeCrystalOnBlock.
public boolean placeCrystalOnBlock(BlockPos bestPos) {
Vec3d pos = CrystalUtil.getRotationPos(false, bestPos, null);
final RayTraceResult result = mc.world.rayTraceBlocks(PlayerUtil.getEyePos(), pos, false, true, false);
EnumFacing facing = (result == null || !bestPos.equals(result.getBlockPos()) || result.sideHit == null) ? EnumFacing.UP : result.sideHit;
Vec3d v = new Vec3d(bestPos).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getDirectionVec()).scale(0.5));
if (result != null && bestPos.equals(result.getBlockPos()) && result.hitVec != null)
v = result.hitVec;
if (bestPos.getY() >= 254)
facing = EnumFacing.EAST;
// offhand
EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.END_CRYSTAL), ItemSwitcher.usedHand.Both, switchingMode.getValue());
if (hand == null)
return false;
// rotate if needed
if (!Spark.rotationManager.rotate(Spark.rotationManager.getLegitRotations(pos), AntiCheatConfig.getInstance().getCrystalRotStep(), 4, false, true))
return false;
// send packet
mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(bestPos, facing, hand, (float) v.x, (float) v.y, (float) v.z));
// swing
switch(AntiCheatConfig.getInstance().crystalPlaceSwing.getValue()) {
case "Normal":
mc.player.swingArm(hand);
break;
case "Packet":
mc.player.connection.sendPacket(new CPacketAnimation(hand));
break;
}
if (render.getValue())
new FadePos(bestPos, fill, true);
return true;
}
use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.
the class AutoWither method onUpdate.
@SubscribeEvent
void onUpdate(PlayerUpdateEvent event) {
if (autoName.isOn()) {
for (Entity entity : mc.world.loadedEntityList) {
if (entity instanceof EntityWither && mc.player.getDistance(entity) < 4) {
EntityWither w = (EntityWither) entity;
if (w.getDisplayName().getUnformattedComponentText().equalsIgnoreCase("Wither")) {
EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.NAME_TAG), ItemSwitcher.usedHand.Both, AntiCheatConfig.getInstance().getBlockPlaceSwitchType());
if (hand != null) {
Vec3d lookAt = RaytraceUtil.getPointToLookAtEntity(w);
if (lookAt == null)
lookAt = w.boundingBox.getCenter();
if (rotateForName.isOn())
if (!Spark.rotationManager.rotate(Spark.rotationManager.getLegitRotations(lookAt), 80, 2, false))
return;
mc.playerController.interactWithEntity(mc.player, w, hand);
return;
}
}
}
}
}
if (placeWither != null) {
int placed = 0;
for (int i = 0; i < placeWither.size(); i++) {
BlockPos p = placeWither.get(i);
if (PlayerUtil.getDistance(p) > 5) {
placeWither = null;
return;
}
if (mc.world.getBlockState(p).getBlock().material.isReplaceable()) {
isDone = 20;
if (placed >= blocksPerTick.getValue())
return;
BlockInteractUtil.BlockPlaceResult res = BlockInteractUtil.tryPlaceBlock(p, new SpecBlockSwitchItem(i < 4 ? Blocks.SOUL_SAND : Blocks.SKULL), true, true, 4, true);
if (res == BlockInteractUtil.BlockPlaceResult.PLACED) {
if (render.getValue())
new FadePos(p, fill, true);
placed++;
} else if (res == BlockInteractUtil.BlockPlaceResult.WAIT)
return;
}
}
if (isDone <= 0) {
placeWither = null;
if (witherPlaceMode.isValueName("ClickSkull"))
Spark.switchManager.Switch(new SpecItemSwitchItem(Items.SKULL), ItemSwitcher.usedHand.Both);
} else
isDone--;
} else if (placeWither == null) {
if (witherPlaceMode.isValueName("Toggle"))
setEnabled(false);
else if (witherPlaceMode.isValueName("Walk") && mc.player.onGround) {
int x = (int) Math.round(Math.max(-1, Math.min(1, (mc.player.posX - mc.player.lastTickPosX) * 22)));
int y = (int) Math.round(Math.max(-1, Math.min(1, (mc.player.posZ - mc.player.lastTickPosZ) * 22)));
if (x != 0 || y != 0) {
BlockPos pos = PlayerUtil.getPlayerPosFloored(mc.player).add(-x * 2, -1, -y * 2);
PlaceWitherAtPos(pos);
}
}
}
}
use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.
the class CrystalAura method doPlace.
boolean doPlace() {
if (currentCrystalBlockPos == null || !CanPlaceOnBlock(currentCrystalBlockPos, true))
return false;
if (placePauseTimer <= 0) {
// get point for rotations
if (delayTimer < 10 && slowFacePlace.getValue() && facePlace) {
return false;
}
Vec3d pos = CrystalUtil.getRotationPos(true, currentCrystalBlockPos, currentCrystalEntity);
if (pos == null)
pos = new Vec3d(currentCrystalBlockPos).add(0.5, 1, 0.5);
final RayTraceResult result = mc.world.rayTraceBlocks(PlayerUtil.getEyePos(), pos, false, true, false);
EnumFacing facing = (result == null || !currentCrystalBlockPos.equals(result.getBlockPos()) || result.sideHit == null) ? EnumFacing.UP : result.sideHit;
Vec3d v = new Vec3d(currentCrystalBlockPos).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getDirectionVec()).scale(0.5));
if (result != null && currentCrystalBlockPos.equals(result.getBlockPos()) && result.hitVec != null)
v = result.hitVec;
if (currentCrystalBlockPos.getY() >= 254)
facing = EnumFacing.EAST;
renderVec = facing;
// update offhand
Offhand.instance.update();
// hand
EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.END_CRYSTAL), ItemSwitcher.usedHand.Both, Spark.switchManager.getModeFromString(switchingMode.getValue()), 10);
if (hand == null)
return false;
// rotate if needed
if (!rotate(false))
return true;
// send packet
mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(currentCrystalBlockPos, facing, hand, (float) v.x, (float) v.y, (float) v.z));
// swing
switch(AntiCheatConfig.getInstance().crystalPlaceSwing.getValue()) {
case "Normal":
mc.player.swingArm(hand);
break;
case "Packet":
mc.player.connection.sendPacket(new CPacketAnimation(hand));
break;
}
if (!isUpdate) {
Spark.switchManager.OnLateUpdate();
}
// apply cooldown/timeout if failed xamount(2by default) places
PlaceTries++;
if (PlaceTries >= placeTries.getValue())
placePauseTimer = placeCooldown.getValue();
// reset delay to wait time before next action
delayTimer = 0;
if (Debug.isOn())
Spark.sendInfo("Place packet sent!");
}
return true;
}
use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.
the class Quiver method onUpdateEvent.
@SubscribeEvent
public void onUpdateEvent(PlayerUpdateEvent event) {
if (nullCheck())
return;
if (mc.currentScreen != null)
return;
if (stage != 0 && Spark.switchManager.Switch(new SpecItemSwitchItem(Items.BOW), ItemSwitcher.usedHand.Mainhand) == null) {
this.disable();
Spark.sendInfo("No bow found");
return;
}
if (stage == 0) {
if (!mapArrows()) {
this.disable();
return;
}
stage++;
} else if (stage == 1) {
this.stage++;
timer++;
return;
} else if (stage == 2) {
mc.gameSettings.keyBindUseItem.pressed = true;
timer = 0;
this.stage++;
} else if (stage == 3) {
if (timer > 4) {
this.stage++;
}
} else if (stage == 4) {
mc.player.connection.sendPacket(new CPacketPlayer.Rotation(mc.player.rotationYaw, -90, mc.player.onGround));
mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, mc.player.getHorizontalFacing()));
mc.player.resetActiveHand();
mc.gameSettings.keyBindUseItem.pressed = false;
timer = 0;
this.stage++;
} else if (stage == 5) {
if (timer < 12) {
timer++;
return;
}
this.stage = 0;
timer = 0;
}
timer++;
}
use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.
the class ShulkerAura method placeCrystal.
private boolean placeCrystal(BlockPos placePos) {
Vec3d pos = CrystalUtil.getRotationPos(true, placePos, null);
if (pos == null)
pos = new Vec3d(placePos).add(0.5, 1, 0.5);
final RayTraceResult result = mc.world.rayTraceBlocks(PlayerUtil.getEyePos(), pos, false, true, false);
EnumFacing facing = (result == null || !placePos.equals(result.getBlockPos()) || result.sideHit == null) ? EnumFacing.UP : result.sideHit;
Vec3d v = new Vec3d(placePos).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getDirectionVec()).scale(0.5));
if (result != null && placePos.equals(result.getBlockPos()) && result.hitVec != null)
v = result.hitVec;
// offhand
EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.END_CRYSTAL), ItemSwitcher.usedHand.Both, ItemSwitcher.switchType.Normal);
if (hand == null) {
disable();
return false;
}
// rotate if needed
if (!Spark.rotationManager.rotate(RotationUtil.getViewRotations(pos, mc.player), AntiCheatConfig.INSTANCE.getCrystalRotStep(), 2, false)) {
return true;
}
// send packet
mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(placePos, facing, hand, (float) v.x, (float) v.y, (float) v.z));
// swing da arms
switch(AntiCheatConfig.getInstance().crystalPlaceSwing.getValue()) {
case "Normal":
mc.player.swingArm(hand);
break;
case "Packet":
mc.player.connection.sendPacket(new CPacketAnimation(hand));
break;
}
return true;
}
Aggregations