use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem in project Spark-Client by Spark-Client-Development.
the class Burrow method OnUpdate.
@SubscribeEvent
void OnUpdate(PlayerUpdateEvent event) {
BlockPos floored = PlayerUtil.getPlayerPosFloored(mc.player, 0.2);
BlockPos pos = floored.add(0, -1, 0);
if (mc.world.getBlockState(floored).getBlock().material.isSolid() && !mc.world.getBlockState(floored.add(0, 1, 0)).getBlock().material.isSolid()) {
if (bypass.isOn()) {
mc.player.motionY = 0;
} else if (KeepPlayer.isOn()) {
Vec3d Center = new Vec3d(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
double l_XDiff = Math.abs(Center.x - mc.player.posX);
double l_ZDiff = Math.abs(Center.z - mc.player.posZ);
if (l_XDiff <= 0.1 && l_ZDiff <= 0.1) {
Center = Vec3d.ZERO;
} else {
double l_MotionX = Center.x - mc.player.posX;
double l_MotionZ = Center.z - mc.player.posZ;
mc.player.motionX = l_MotionX * 0.6f;
mc.player.motionZ = l_MotionZ * 0.6f;
}
}
} else if (status > 20)
this.setEnabled(false);
if (status == 0) {
if (!mc.player.onGround) {
this.setEnabled(false);
return;
} else {
List<Entity> l = mc.world.getEntitiesWithinAABBExcludingEntity(mc.player, new AxisAlignedBB(floored));
for (Entity e : l) {
if (!(e instanceof EntityItem) && !e.isDead) {
this.setEnabled(false);
return;
}
}
}
if (Surround.instance.isPlacing())
return;
if (center.isOn()) {
Vec3d Center = new Vec3d(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
double l_XDiff = Math.abs(Center.x - mc.player.posX);
double l_ZDiff = Math.abs(Center.z - mc.player.posZ);
if (l_XDiff <= 0.1 && l_ZDiff <= 0.1) {
} else {
double l_MotionX = Center.x - mc.player.posX;
double l_MotionZ = Center.z - mc.player.posZ;
mc.player.motionX = l_MotionX / 2;
mc.player.motionZ = l_MotionZ / 2;
return;
}
}
EnumHand hand = Spark.switchManager.Switch(new SpecBlockSwitchItem(getUse()), ItemSwitcher.usedHand.Both);
if (UseOtherBlocks.isOn() && hand == null)
hand = Spark.switchManager.Switch(new HardSolidBlockSwitchItem(), ItemSwitcher.usedHand.Both);
if (hand == null) {
this.setEnabled(false);
return;
}
if (Rotate.isOn()) {
sendPlayerRot(90, 90, true);
}
if (OneTick.isOn())
status = 1;
}
if (status == 1) {
Spark.rotationManager.setCancelNextWalkingUpdate();
sendPlayerPos(mc.player.posX, mc.player.posY + 0.41999998688698, mc.player.posZ, false);
sendPlayerPos(mc.player.posX, mc.player.posY + 0.7531999805212, mc.player.posZ, false);
sendPlayerPos(mc.player.posX, mc.player.posY + 1.001335979, mc.player.posZ, false);
sendPlayerPos(mc.player.posX, mc.player.posY + 1.16610926, mc.player.posZ, false);
EnumHand hand = Spark.switchManager.Switch(new SpecBlockSwitchItem(getUse()), ItemSwitcher.usedHand.Both);
if (UseOtherBlocks.isOn() && hand == null)
hand = Spark.switchManager.Switch(new HardSolidBlockSwitchItem(), ItemSwitcher.usedHand.Both);
if (hand == null) {
this.setEnabled(false);
return;
}
if (!BlockInteractUtil.processRightClickBlock(pos, EnumFacing.UP, false, hand, new Vec3d(mc.player.posX, pos.getY() + 0.5, mc.player.posZ)))
return;
Spark.sendInfo("placing burrow block");
if (OneTick.isOn())
status = 2;
}
if (status == 2) {
Vec3i clip = getClip();
sendPlayerPos(mc.player.posX + clip.getX(), mc.player.posY + clip.getY(), mc.player.posZ + clip.getZ(), true);
}
status++;
}
Aggregations