mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-17 11:15:12 -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,8 +17,14 @@ 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) {
|
||||
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)) {
|
||||
@ -26,6 +32,11 @@ object EventHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
currentlyPlacing = false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def place(player: EntityPlayer) = {
|
||||
val world = player.getEntityWorld
|
||||
|
Loading…
x
Reference in New Issue
Block a user