(BugFix): Fixes powder chest click not being detected correctly
This commit is contained in:
parent
ed04c31578
commit
98eb315142
@ -60,27 +60,9 @@ object ChestEsp {
|
||||
fun rightClickEvent(event: PlayerInteractEvent) {
|
||||
if (!enabled) return
|
||||
if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||
val player = event.entityPlayer
|
||||
val reachDistance = 5.0
|
||||
val eyePosition = player.getPositionEyes(1.0f)
|
||||
val lookVec = player.getLook(1.0f)
|
||||
val reachVec = eyePosition.addVector(
|
||||
lookVec.xCoord * reachDistance,
|
||||
lookVec.yCoord * reachDistance,
|
||||
lookVec.zCoord * reachDistance
|
||||
)
|
||||
val rayTraceResult = event.world.rayTraceBlocks(eyePosition, reachVec, false, false, false)
|
||||
|
||||
if (rayTraceResult != null && rayTraceResult.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
val pos = rayTraceResult.blockPos
|
||||
|
||||
val x = pos.x
|
||||
val y = pos.y
|
||||
val z = pos.z
|
||||
|
||||
if (chestNodeExists(x, y, z)) {
|
||||
chestList.removeIf { it.x == x && it.y == y && it.z == z }
|
||||
}
|
||||
val pos = event.pos
|
||||
if (chestNodeExists(pos.x, pos.y, pos.z)) {
|
||||
chestList.removeIf { it.x == pos.x && it.y == pos.y && it.z == pos.z }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user