use of meteordevelopment.orbit.EventHandler 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.orbit.EventHandler in project meteor-rejects by AntiCope.
the class BoatPhase method onBoatMove.
@EventHandler
private void onBoatMove(BoatMoveEvent event) {
if (mc.player.getVehicle() != null && mc.player.getVehicle().getType().equals(EntityType.BOAT)) {
if (boat != mc.player.getVehicle()) {
if (boat != null) {
boat.noClip = false;
}
boat = (BoatEntity) mc.player.getVehicle();
}
} else
boat = null;
if (boat != null) {
boat.noClip = true;
if (lockYaw.get()) {
boat.setYaw(mc.player.getYaw());
}
Vec3d vel;
if (adjustHorizontalSpeed.get()) {
vel = PlayerUtils.getHorizontalVelocity(horizontalSpeed.get());
} else {
vel = boat.getVelocity();
}
double velX = vel.x;
double velY = 0;
double velZ = vel.z;
if (verticalControl.get()) {
if (mc.options.jumpKey.isPressed())
velY += verticalSpeed.get() / 20;
if (mc.options.sprintKey.isPressed())
velY -= verticalSpeed.get() / 20;
else if (fall.get())
velY -= fallSpeed.get() / 20;
} else if (fall.get())
velY -= fallSpeed.get() / 20;
((IVec3d) boat.getVelocity()).set(velX, velY, velZ);
}
}
use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.
the class ColorSigns method onPacketSend.
@EventHandler
private void onPacketSend(PacketEvent.Send event) {
if (event.packet instanceof GameJoinS2CPacket) {
checkWarning();
return;
}
if (!(event.packet instanceof UpdateSignC2SPacket))
return;
UpdateSignC2SPacket p = (UpdateSignC2SPacket) event.packet;
for (int l = 0; l < p.getText().length; l++) {
String newText = p.getText()[l].replaceAll("(?i)\u00a7|&([0-9A-FK-OR])", "\u00a7\u00a7$1$1");
p.getText()[l] = newText;
}
event.packet = p;
}
use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.
the class Confuse method onRender.
@EventHandler
private void onRender(Render3DEvent event) {
if (target == null)
return;
boolean flag = budgetGraphics.get();
Vec3d last = null;
addition += flag ? 0 : 1.0;
if (addition > 360)
addition = 0;
for (int i = 0; i < 360; i += flag ? 7 : 1) {
Color c1;
if (flag)
c1 = circleColor.get();
else {
double rot = (255.0 * 3) * (((((double) i) + addition) % 360) / 360.0);
int seed = (int) Math.floor(rot / 255.0);
double current = rot % 255;
double red = seed == 0 ? current : (seed == 1 ? Math.abs(current - 255) : 0);
double green = seed == 1 ? current : (seed == 2 ? Math.abs(current - 255) : 0);
double blue = seed == 2 ? current : (seed == 0 ? Math.abs(current - 255) : 0);
c1 = new Color((int) red, (int) green, (int) blue);
}
Vec3d tp = target.getPos();
double rad = Math.toRadians(i);
double sin = Math.sin(rad) * 3;
double cos = Math.cos(rad) * 3;
Vec3d c = new Vec3d(tp.x + sin, tp.y + target.getHeight() / 2, tp.z + cos);
if (last != null)
event.renderer.line(last.x, last.y, last.z, c.x, c.y, c.z, c1);
last = c;
}
}
use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.
the class Confuse method onTick.
@EventHandler
private void onTick(TickEvent.Pre event) {
// Delay
delayWaited++;
if (delayWaited < delay.get())
return;
delayWaited = 0;
// Targetting
target = TargetUtils.getPlayerTarget(range.get(), priority.get());
if (target == null)
return;
Vec3d entityPos = target.getPos();
Vec3d playerPos = mc.player.getPos();
Random r = new Random();
BlockHitResult hit;
int halfRange = range.get() / 2;
switch(mode.get()) {
case RandomTP:
double x = r.nextDouble() * range.get() - halfRange;
double y = 0;
double z = r.nextDouble() * range.get() - halfRange;
Vec3d addend = new Vec3d(x, y, z);
Vec3d goal = entityPos.add(addend);
if (mc.world.getBlockState(new BlockPos(goal.x, goal.y, goal.z)).getBlock() != Blocks.AIR) {
goal = new Vec3d(x, playerPos.y, z);
}
if (mc.world.getBlockState(new BlockPos(goal.x, goal.y, goal.z)).getBlock() == Blocks.AIR) {
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
delayWaited = (int) (delay.get() - 1);
break;
}
mc.player.updatePosition(goal.x, goal.y, goal.z);
} else {
delayWaited = (int) (delay.get() - 1);
}
break;
case Switch:
Vec3d diff = entityPos.subtract(playerPos);
Vec3d diff1 = new Vec3d(Utils.clamp(diff.x, -halfRange, halfRange), Utils.clamp(diff.y, -halfRange, halfRange), Utils.clamp(diff.z, -halfRange, halfRange));
Vec3d goal2 = entityPos.add(diff1);
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
delayWaited = (int) (delay.get() - 1);
break;
}
mc.player.updatePosition(goal2.x, goal2.y, goal2.z);
break;
case Circle:
delay.set(0);
circleProgress += circleSpeed.get();
if (circleProgress > 360)
circleProgress -= 360;
double rad = Math.toRadians(circleProgress);
double sin = Math.sin(rad) * 3;
double cos = Math.cos(rad) * 3;
Vec3d current = new Vec3d(entityPos.x + sin, playerPos.y, entityPos.z + cos);
hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), current, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
if (!moveThroughBlocks.get() && hit.isInsideBlock())
break;
mc.player.updatePosition(current.x, current.y, current.z);
break;
}
}
Aggregations