use of me.wallhacks.spark.util.objects.FadePos in project Spark-Client by Spark-Client-Development.
the class FadeManager method onRender.
@SubscribeEvent
public void onRender(RenderWorldLastEvent event) {
ArrayList<BlockPos> remove = new ArrayList<>();
int maxTime = (int) (ClientConfig.getInstance().getFadeTime() * 1000);
for (FadePos pos : getPositions()) {
int current = (int) pos.fadeTimer.getPassedTimeMs();
if (current > maxTime) {
remove.add(pos.pos);
continue;
}
Color fill;
if (pos.isFading()) {
double percent = Math.min((double) (maxTime - current) / maxTime, 1);
fill = new Color(pos.fill.getColor().getRed(), pos.fill.getColor().getGreen(), pos.fill.getColor().getBlue(), (int) (pos.fill.getColor().getAlpha() * percent));
} else {
fill = pos.fill.getColor();
pos.fadeTimer.reset();
}
EspUtil.drawBox(pos.pos, fill);
EspUtil.drawOutline(pos.pos, fill.brighter());
}
for (BlockPos r : remove) {
positions.remove(r);
}
}
use of me.wallhacks.spark.util.objects.FadePos 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.objects.FadePos in project Spark-Client by Spark-Client-Development.
the class CrystalAura method getCrystalPlacePos.
void getCrystalPlacePos() {
BlockPos bestPos = null;
targetEntity = null;
float bestValue = 0;
for (BlockPos pos : WorldUtils.getSphere(PlayerUtil.getPlayerPosFloored(mc.player), 7, 7, 1)) {
if (CanPlaceOnBlock(pos, false)) {
ValueForExplodingCrystalAtPoint Value = getValueForCrystalExplodingAtPoint(new Vec3d(pos.getX() + 0.5f, pos.getY() + 1, pos.getZ() + 0.5f), prePlace.getValue());
if (pos.equals(currentCrystalBlockPos) && Value.value > 0)
Value.value += switchThreshold.getValue();
if (Value.value > bestValue) {
bestValue = Value.value;
if (Value.target != null)
targetEntity = Value.target.entity;
bestPos = pos;
facePlace = Value.facePlace;
}
}
}
currentCrystalBlockPos = bestPos;
if (bestPos != null) {
if (currentPos == null) {
currentPos = new FadePos(bestPos, fill, false);
} else if (currentPos.pos != bestPos) {
currentPos.startFade();
currentPos = new FadePos(bestPos, fill, false);
}
} else if (currentPos != null) {
currentPos.startFade();
currentPos = null;
}
if (currentPos != null)
Spark.fadeManager.getPositions().removeIf(fadePos -> fadePos.pos.equals(currentPos.pos) && fadePos != currentPos);
}
use of me.wallhacks.spark.util.objects.FadePos in project Spark-Client by Spark-Client-Development.
the class Surround method OnUpdate.
@SubscribeEvent
void OnUpdate(PlayerUpdateEvent event) {
isPlacing = false;
// PlayerUtil.isInBlocks(mc.player) checks if we are in blocks
if (disable.is("OffGround") && !PlayerUtil.isInBlocks(mc.player) && !mc.player.onGround) {
disable();
return;
}
BlockPos blockUnderPlayer = PlayerUtil.getPlayerPosFloored(mc.player, 0.2);
if (!SnapToCenter.isValueName("Off"))
if (!PlayerUtil.MoveCenter(blockUnderPlayer, SnapToCenter.isValueName("OnPlace")))
return;
ArrayList<BlockPos> aroundPlayer = new ArrayList<BlockPos>();
List<BlockPos> occupiedByPlayer = WorldUtils.getBlocksOccupiedByBox(mc.player.boundingBox);
for (BlockPos floored : occupiedByPlayer) {
BlockPos[] poses = new BlockPos[] { floored.add(1, 0, 0), floored.add(0, 0, 1), floored.add(-1, 0, 0), floored.add(0, 0, -1) };
for (BlockPos p : poses) if (!occupiedByPlayer.contains(p)) {
aroundPlayer.add(p);
}
for (BlockPos p : poses) if (occupiedByPlayer.contains(p))
aroundPlayer.add(p.add(0, -1, 0));
}
ArrayList<BlockPos> poses = new ArrayList<BlockPos>();
if (bottomFill.isOn() && mc.player.isJumping) {
if (!poses.contains(blockUnderPlayer.add(0, -1, 0)))
poses.add(blockUnderPlayer.add(0, -1, 0));
}
for (BlockPos p : aroundPlayer) {
if (!poses.contains(p))
poses.add(p);
}
if (bottomFill.isOn() && !mc.player.isJumping) {
if (!poses.contains(blockUnderPlayer.add(0, -1, 0)))
poses.add(blockUnderPlayer.add(0, -1, 0));
}
int placed = 0;
boolean done = true;
for (BlockPos x : poses) {
if (mc.world.getBlockState(x).getBlock().material.isReplaceable()) {
BlockPos p = getBlockPosToPlaceAtBlock(x);
if (p != null) {
done = false;
BlockInteractUtil.BlockPlaceResult res = Place(p);
if (res != BlockInteractUtil.BlockPlaceResult.FAILED)
isPlacing = true;
if (res == BlockInteractUtil.BlockPlaceResult.PLACED) {
if (render.getValue())
new FadePos(p, fill, true);
placed++;
} else if (res == BlockInteractUtil.BlockPlaceResult.WAIT)
return;
if (placed >= blocksPerTick.getValue())
return;
}
}
}
if (done && disable.is("Done"))
this.disable();
}
use of me.wallhacks.spark.util.objects.FadePos 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);
}
}
}
}
Aggregations