mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Small cleanup for PlayerInteractEvent (#3563)
This commit is contained in:
1 parent
60211e6cd6
commit
43efa3cfc4
3 files changed
+22
-7
No files matched your search
@@ -1062,9 +1062,17 @@ public class ForgeHooks
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.RightClickEmpty(player, hand));
|
||||
}
|
||||
|
||||
public static void onEmptyLeftClick(EntityPlayer player)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.LeftClickEmpty(player));
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/** @deprecated use {@link ForgeHooks#onEmptyLeftClick(EntityPlayer)} */
|
||||
@Deprecated
|
||||
public static void onEmptyLeftClick(EntityPlayer player, @Nonnull ItemStack stack)
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post(new PlayerInteractEvent.LeftClickEmpty(player, stack));
|
||||
onEmptyLeftClick(player);
|
||||
}
|
||||
|
||||
private static ThreadLocal<Deque<LootTableContext>> lootContext = new ThreadLocal<Deque<LootTableContext>>();
|
||||
|
||||
@@ -20,16 +20,13 @@
|
||||
package net.minecraftforge.event.entity.player;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
||||
@@ -313,22 +310,31 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
*/
|
||||
public static class LeftClickEmpty extends PlayerInteractEvent
|
||||
{
|
||||
public LeftClickEmpty(EntityPlayer player, @Nonnull ItemStack stack)
|
||||
public LeftClickEmpty(EntityPlayer player)
|
||||
{
|
||||
super(player, EnumHand.MAIN_HAND, new BlockPos(player), null);
|
||||
}
|
||||
|
||||
// TODO: remove
|
||||
/** @deprecated use {@link LeftClickEmpty(EntityPlayer)} */
|
||||
@Deprecated
|
||||
public LeftClickEmpty(EntityPlayer player, @Nonnull ItemStack stack)
|
||||
{
|
||||
this(player);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The hand involved in this interaction. Will never be null.
|
||||
*/
|
||||
@Nonnull
|
||||
public EnumHand getHand()
|
||||
{
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The itemstack involved in this interaction, or null if the hand was empty.
|
||||
* @return The itemstack involved in this interaction, {@code ItemStack.EMPTY} if the hand was empty.
|
||||
*/
|
||||
@Nonnull
|
||||
public ItemStack getItemStack()
|
||||
@@ -343,6 +349,7 @@ public class PlayerInteractEvent extends PlayerEvent
|
||||
* Will never be null.
|
||||
* @return The position involved in this interaction.
|
||||
*/
|
||||
@Nonnull
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
|
||||
Reference in new issue
Block a user