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}
|
import net.minecraftforge.event.entity.player.{PlayerDestroyItemEvent, PlayerInteractEvent}
|
||||||
|
|
||||||
object EventHandler {
|
object EventHandler {
|
||||||
|
private var currentlyPlacing = false
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
def playerInteract(event: PlayerInteractEvent) {
|
def playerInteract(event: PlayerInteractEvent) {
|
||||||
|
this.synchronized {
|
||||||
|
if (currentlyPlacing) return
|
||||||
|
try {
|
||||||
|
currentlyPlacing = true
|
||||||
val player = event.entityPlayer
|
val player = event.entityPlayer
|
||||||
if (event.action == Action.RIGHT_CLICK_BLOCK && player.getEntityWorld.isRemote) {
|
if (event.action == Action.RIGHT_CLICK_BLOCK && player.getEntityWorld.isRemote) {
|
||||||
if (place(player)) {
|
if (place(player)) {
|
||||||
@ -26,6 +32,11 @@ object EventHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
currentlyPlacing = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
def place(player: EntityPlayer) = {
|
def place(player: EntityPlayer) = {
|
||||||
val world = player.getEntityWorld
|
val world = player.getEntityWorld
|
||||||
|
Loading…
x
Reference in New Issue
Block a user