mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-19 03:49:14 +00:00
Add target world to PlayerInteractEvent for potential 'cross dimension' interaction such as LittleBlocks. Closes #1071
This commit is contained in:
1 parent
eb1ddab278
commit
b301b1f70c
5 files changed
+24
-9
No files matched your search
@@ -51,9 +51,14 @@ public class ForgeEventFactory
|
||||
return (MinecraftForge.EVENT_BUS.post(event) ? -1 : event.newSpeed);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, int x, int y, int z, int face)
|
||||
{
|
||||
PlayerInteractEvent event = new PlayerInteractEvent(player, action, x, y, z, face);
|
||||
return onPlayerInteract(player, action, x, y, z, face, null);
|
||||
}
|
||||
public static PlayerInteractEvent onPlayerInteract(EntityPlayer player, Action action, int x, int y, int z, int face, World world)
|
||||
{
|
||||
PlayerInteractEvent event = new PlayerInteractEvent(player, action, x, y, z, face, world);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return event;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
import static cpw.mods.fml.common.eventhandler.Event.Result.DEFAULT;
|
||||
import static cpw.mods.fml.common.eventhandler.Event.Result.DENY;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import static cpw.mods.fml.common.eventhandler.Event.Result.*;
|
||||
import net.minecraft.world.World;
|
||||
import cpw.mods.fml.common.eventhandler.Cancelable;
|
||||
|
||||
@Cancelable
|
||||
public class PlayerInteractEvent extends PlayerEvent
|
||||
@@ -19,11 +21,18 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
public final int y;
|
||||
public final int z;
|
||||
public final int face;
|
||||
public final World world;
|
||||
|
||||
public Result useBlock = DEFAULT;
|
||||
public Result useItem = DEFAULT;
|
||||
|
||||
|
||||
@Deprecated
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face)
|
||||
{
|
||||
this(player, action, x, y, z, face, player.worldObj);
|
||||
}
|
||||
|
||||
public PlayerInteractEvent(EntityPlayer player, Action action, int x, int y, int z, int face, World world)
|
||||
{
|
||||
super(player);
|
||||
this.action = action;
|
||||
@@ -32,6 +41,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
this.z = z;
|
||||
this.face = face;
|
||||
if (face == -1) useBlock = DENY;
|
||||
this.world = world;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user