use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.BlockSwitchItem in project Spark-Client by Spark-Client-Development.
the class BlockInteractUtil method tryPlaceBlockOnBlock.
public static BlockPlaceResult tryPlaceBlockOnBlock(BlockPos pos, EnumFacing face, BlockSwitchItem switcher, ItemSwitcher.switchType switchType, boolean clientSided, boolean checkEntities, int rotationStayTicks, boolean allowSendMultipleRotPacket) {
if (!mc.world.getBlockState(pos).getMaterial().isReplaceable())
return BlockPlaceResult.FAILED;
Item willuse = Spark.switchManager.predictItem(switcher, ItemSwitcher.usedHand.Both, switchType);
if (!(willuse instanceof ItemBlock) && !(willuse instanceof ItemSkull) && willuse != Items.SKULL && willuse != Items.WATER_BUCKET && willuse != Items.LAVA_BUCKET)
return BlockPlaceResult.FAILED;
if (checkEntities && !blockCollisionCheck(pos, ((ItemBlock) willuse).getBlock()))
return BlockPlaceResult.FAILED;
if (face == null)
return BlockPlaceResult.FAILED;
BlockPos placeOn = pos.offset(face, -1);
if (mc.world.getBlockState(placeOn).getBlock().isReplaceable(mc.world, placeOn))
return BlockPlaceResult.FAILED;
Vec3d hitVec = getPointOnBlockFace(placeOn, face);
if (hitVec == null)
return BlockPlaceResult.FAILED;
EnumHand hand = Spark.switchManager.Switch(switcher, ItemSwitcher.usedHand.Both, switchType);
if (hand == null)
return BlockPlaceResult.FAILED;
if (AntiCheatConfig.getInstance().getBlockRotate())
if (!Spark.rotationManager.rotate(Spark.rotationManager.getLegitRotations(hitVec), AntiCheatConfig.getInstance().getBlockRotStep(), rotationStayTicks, allowSendMultipleRotPacket))
return BlockPlaceResult.WAIT;
mc.playerController.syncCurrentPlayItem();
return processRightClickBlockForPlace(placeOn, face, clientSided, hand, hitVec) ? BlockPlaceResult.PLACED : BlockPlaceResult.FAILED;
}
use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.BlockSwitchItem in project Spark-Client by Spark-Client-Development.
the class BlockInteractUtil method tryPlaceBlock.
public static BlockPlaceResult tryPlaceBlock(BlockPos pos, BlockSwitchItem switcher, ItemSwitcher.switchType switchType, boolean clientSided, boolean checkEntities, int rotationStayTicks, boolean allowSendMultipleRotPacket) {
if (!mc.world.getBlockState(pos).getMaterial().isReplaceable())
return BlockPlaceResult.FAILED;
Item willuse = null;
if (switcher != null) {
willuse = Spark.switchManager.predictItem(switcher, ItemSwitcher.usedHand.Both, switchType);
if (!(willuse instanceof ItemBlock) && !(willuse instanceof ItemSkull) && willuse != Items.SKULL && willuse != Items.WATER_BUCKET && willuse != Items.LAVA_BUCKET)
return BlockPlaceResult.FAILED;
}
if (checkEntities && !blockCollisionCheck(pos, willuse == null || !(willuse instanceof ItemBlock) ? null : ((ItemBlock) willuse).getBlock()))
return BlockPlaceResult.FAILED;
EnumFacing face = getDirForPlacingBlockAtPos(pos);
if (face == null)
return BlockPlaceResult.FAILED;
BlockPos placeOn = pos.offset(face, -1);
Vec3d hitVec = getPointOnBlockFace(placeOn, face);
if (hitVec == null)
return BlockPlaceResult.FAILED;
EnumHand hand = Spark.switchManager.Switch(switcher, ItemSwitcher.usedHand.Both, switchType);
if (hand == null)
return BlockPlaceResult.FAILED;
if (AntiCheatConfig.getInstance().getBlockRotate())
if (!Spark.rotationManager.rotate(Spark.rotationManager.getLegitRotations(hitVec), AntiCheatConfig.getInstance().getBlockRotStep(), rotationStayTicks, allowSendMultipleRotPacket))
return BlockPlaceResult.WAIT;
mc.playerController.syncCurrentPlayItem();
return processRightClickBlockForPlace(placeOn, face, clientSided, hand, hitVec) ? BlockPlaceResult.PLACED : BlockPlaceResult.FAILED;
}
Aggregations