mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-18 11:48:02 -04:00
Added guard against recursive player interaction events in FMP placement handler, should fix #478.
This commit is contained in:
parent
de44148df3
commit
9f9522c82e
@ -17,12 +17,23 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action
|
||||
import net.minecraftforge.event.entity.player.{PlayerDestroyItemEvent, PlayerInteractEvent}
|
||||
|
||||
object EventHandler {
|
||||
private var currentlyPlacing = false
|
||||
|
||||
@ForgeSubscribe
|
||||
def playerInteract(event: PlayerInteractEvent) {
|
||||
val player = event.entityPlayer
|
||||
if (event.action == Action.RIGHT_CLICK_BLOCK && player.getEntityWorld.isRemote) {
|
||||
if (place(player)) {
|
||||
event.setCanceled(true)
|
||||
this.synchronized {
|
||||
if (currentlyPlacing) return
|
||||
try {
|
||||
currentlyPlacing = true
|
||||
val player = event.entityPlayer
|
||||
if (event.action == Action.RIGHT_CLICK_BLOCK && player.getEntityWorld.isRemote) {
|
||||
if (place(player)) {
|
||||
event.setCanceled(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
currentlyPlacing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user