(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) {
|
fun rightClickEvent(event: PlayerInteractEvent) {
|
||||||
if (!enabled) return
|
if (!enabled) return
|
||||||
if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
if (event.action == PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK) {
|
||||||
val player = event.entityPlayer
|
val pos = event.pos
|
||||||
val reachDistance = 5.0
|
if (chestNodeExists(pos.x, pos.y, pos.z)) {
|
||||||
val eyePosition = player.getPositionEyes(1.0f)
|
chestList.removeIf { it.x == pos.x && it.y == pos.y && it.z == pos.z }
|
||||||
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 }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user