Skip to content
This repository has been archived by the owner on May 12, 2024. It is now read-only.

Commit

Permalink
Bed Aura use offhand bed if possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Luna5ama committed Sep 16, 2023
1 parent 69b51b3 commit fb296be
Showing 1 changed file with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -518,27 +518,20 @@ internal object BedAura : Module(
inactiveTicks = 0
}

private fun SafeClientEvent.placeBed(placeInfo: PlaceInfo) {
private fun SafeClientEvent.placeBed(placeInfo: PlaceInfo
) {
val shouldSneak = !player.isSneaking
if (shouldSneak) connection.sendPacket(CPacketEntityAction(player, CPacketEntityAction.Action.START_SNEAKING))
val placePacket = CPacketPlayerTryUseItemOnBlock(placeInfo.basePos, EnumFacing.UP, handMode, 0.5f, 1.0f, 0.5f)

if (handMode == EnumHand.MAIN_HAND) {
ghostSwitch(ghostSwitchBypass, bedSlot - 1) {
if (player.heldItemOffhand.item == Items.BED) {
val placePacket = CPacketPlayerTryUseItemOnBlock(placeInfo.basePos, EnumFacing.UP, EnumHand.OFF_HAND, 0.5f, 1.0f, 0.5f)
OffhandPause.withPause(BedAura) {
connection.sendPacket(placePacket)
}
} else {
OffhandPause.withPause(BedAura) {
connection.sendPacket(
CPacketPlayerTryUseItemOnBlock(
placeInfo.basePos,
EnumFacing.UP,
handMode,
0.5f,
1.0f,
0.5f
)
)
val placePacket = CPacketPlayerTryUseItemOnBlock(placeInfo.basePos, EnumFacing.UP, EnumHand.MAIN_HAND, 0.5f, 1.0f, 0.5f)
ghostSwitch(ghostSwitchBypass, bedSlot - 1) {
connection.sendPacket(placePacket)
}
}

Expand Down

0 comments on commit fb296be

Please sign in to comment.