mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-17 19:15:11 +00:00
Added handling case for mods that call removeBlockByPlayer when the player isn't looking at the block.
Added guard for mods that recursively call PlayerInteractEvent. Fixed npe when obtaining class bytes in ASMMixinCompiler
This commit is contained in:
1 parent
09c387ae6c
commit
e7ec7db447
3 files changed
+31
-9
No files matched your search
@@ -19,11 +19,20 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
|
||||
|
||||
public class EventHandler
|
||||
{
|
||||
private ThreadLocal<Object> placing = new ThreadLocal<Object>();
|
||||
|
||||
@ForgeSubscribe
|
||||
public void playerInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if(event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote && place(event.entityPlayer, event.entityPlayer.worldObj))
|
||||
event.setCanceled(true);
|
||||
if(event.action == Action.RIGHT_CLICK_BLOCK && event.entityPlayer.worldObj.isRemote)
|
||||
{
|
||||
if(placing.get() != null)
|
||||
return;//for mods that do dumb stuff and call this event like MFR
|
||||
placing.set(event);
|
||||
if(place(event.entityPlayer, event.entityPlayer.worldObj))
|
||||
event.setCanceled(true);
|
||||
placing.set(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean place(EntityPlayer player, World world)
|
||||
|
||||
Reference in new issue
Block a user