2012-09-27 04:18:18 +00:00
|
|
|
package net.minecraftforge.event.entity.player;
|
|
|
|
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import static net.minecraftforge.fml.common.eventhandler.Event.Result.DEFAULT;
|
|
|
|
import static net.minecraftforge.fml.common.eventhandler.Event.Result.DENY;
|
2012-12-13 05:58:35 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-03-01 12:58:03 +00:00
|
|
|
import net.minecraft.util.math.BlockPos;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-03-01 12:58:03 +00:00
|
|
|
import net.minecraft.util.math.Vec3d;
|
2014-06-02 22:49:11 +00:00
|
|
|
import net.minecraft.world.World;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
import net.minecraftforge.fml.common.eventhandler.Cancelable;
|
2012-09-27 04:18:18 +00:00
|
|
|
|
2014-07-06 20:07:49 +00:00
|
|
|
/**
|
|
|
|
* PlayerInteractEvent is fired when a player interacts in some way.
|
|
|
|
* <br>
|
|
|
|
* This event is fired whenever a player interacts in
|
|
|
|
* Minecraft#func_147121_ag(),
|
|
|
|
* NetHandlerPlayServer#processPlayerBlockPlacement(C08PacketPlayerBlockPlacement),
|
|
|
|
* ItemInWorldManager#activateBlockOrUseItem(EntityPlayer, World, ItemStack, int, int, int, int, float, float, float),
|
|
|
|
* ItemInWorldManager#onBlockClicked(int, int, int, int). <br>
|
|
|
|
* <br>
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
* This event is fired via the {@link ForgeEventFactory#onPlayerInteract(EntityPlayer, Action, BlockPos, EnumFacing)}.
|
2014-07-06 20:07:49 +00:00
|
|
|
* <br>
|
2016-03-23 14:34:48 +00:00
|
|
|
* {@link #action} contains the Action the player performed during this interaction. <br>
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
* {@link #pos} contains the coordinate of where this event occurred.<br>
|
|
|
|
* {@link #face} contains the face of the block that was interacted with. May be null if unknown. <br>
|
2014-07-06 20:07:49 +00:00
|
|
|
* {@link #world} contains the world in which this event is occurring. <br>
|
|
|
|
* <br>
|
|
|
|
* This event is {@link Cancelable}.<br>
|
|
|
|
* If this event is canceled, the player does not interact.<br>
|
|
|
|
* <br>
|
|
|
|
* This event does not have a result. {@link HasResult}<br>
|
|
|
|
* <br>
|
|
|
|
* This event is fired on the {@link MinecraftForge#EVENT_BUS}.
|
|
|
|
**/
|
2012-09-27 04:18:18 +00:00
|
|
|
@Cancelable
|
|
|
|
public class PlayerInteractEvent extends PlayerEvent
|
|
|
|
{
|
|
|
|
public static enum Action
|
|
|
|
{
|
|
|
|
RIGHT_CLICK_AIR,
|
|
|
|
RIGHT_CLICK_BLOCK,
|
|
|
|
LEFT_CLICK_BLOCK
|
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2016-03-24 08:44:52 +00:00
|
|
|
private final Action action;
|
|
|
|
private final World world;
|
|
|
|
private final BlockPos pos;
|
|
|
|
private final EnumFacing face; // Can be null if unknown
|
|
|
|
private final Vec3d localPos; // Can be null if unknown
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2016-03-24 08:44:52 +00:00
|
|
|
private Result useBlock = DEFAULT;
|
|
|
|
private Result useItem = DEFAULT;
|
2014-06-02 22:49:11 +00:00
|
|
|
|
2016-02-27 01:27:21 +00:00
|
|
|
@Deprecated
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world)
|
2016-02-27 01:27:21 +00:00
|
|
|
{
|
|
|
|
this(player, action, pos, face, world, null);
|
|
|
|
}
|
|
|
|
|
2016-03-01 12:58:03 +00:00
|
|
|
public PlayerInteractEvent(EntityPlayer player, Action action, BlockPos pos, EnumFacing face, World world, Vec3d localPos)
|
2012-09-27 04:18:18 +00:00
|
|
|
{
|
|
|
|
super(player);
|
|
|
|
this.action = action;
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
this.pos = pos;
|
2012-09-27 04:18:18 +00:00
|
|
|
this.face = face;
|
2016-03-24 08:44:52 +00:00
|
|
|
if (face == null) setUseBlock(DENY);
|
2014-06-02 22:49:11 +00:00
|
|
|
this.world = world;
|
2016-02-27 01:27:21 +00:00
|
|
|
this.localPos = localPos;
|
2012-09-27 04:18:18 +00:00
|
|
|
}
|
Initial update to 1.8, Super beta. Most rendering related hooks are out due to major changes in 1.8.
Some notes:
Almost all int x, int y, int z parameters have been changed to BlockPos class
ForgeDirection has been removed, replaced by net.minecraft.util.EnumFacing.
All FML classes have moved from packet cpw.mods.fml to net.minecraftforge.fml
Fluid Rendering has been disabled for the time being, to be re-evaulated and a test mod created for it.
Minecraft now uses a Model based system for rendering blocks and Items. The intention is to expand the model format to better suit modder's needed once it is evaulated.
As such, The model loaders from Forge have been removed, to be replaced by expanding vanilla's model format.
Metadata has been extracted out in Minecraft to IBlockState, which holds a list of properties instead of magic number metadata. DO NOT listen to the fearmongering, you can do EVERYTHING with block states you could previously with metadata.
Stencil Bits are disabled entirely by for the main Display, Modders must enable and recreate the FrameBuffer if they wish to use Stencil Bits.
2014-11-26 03:56:35 +00:00
|
|
|
|
2012-09-27 04:18:18 +00:00
|
|
|
@Override
|
|
|
|
public void setCanceled(boolean cancel)
|
|
|
|
{
|
2012-11-13 01:34:26 +00:00
|
|
|
super.setCanceled(cancel);
|
2016-03-24 08:44:52 +00:00
|
|
|
setUseBlock((cancel ? DENY : getUseBlock() == DENY ? DEFAULT : getUseBlock()));
|
|
|
|
setUseItem((cancel ? DENY : getUseItem() == DENY ? DEFAULT : getUseItem()));
|
2012-09-27 04:18:18 +00:00
|
|
|
}
|
2016-03-24 08:44:52 +00:00
|
|
|
|
|
|
|
public Action getAction() { return action; }
|
|
|
|
public World getWorld() { return world; }
|
|
|
|
public BlockPos getPos() { return pos; }
|
|
|
|
public EnumFacing getFace() { return face; }
|
|
|
|
public Vec3d getLocalPos() { return localPos; }
|
|
|
|
public Result getUseBlock() { return useBlock; }
|
|
|
|
public void setUseBlock(Result useBlock) { this.useBlock = useBlock; }
|
|
|
|
public Result getUseItem() { return useItem; }
|
|
|
|
public void setUseItem(Result useItem) { this.useItem = useItem; }
|
2012-09-27 04:18:18 +00:00
|
|
|
}
|