Java Code Examples for net.minecraft.entity.player.EntityPlayer#rayTrace()

The following examples show how to use net.minecraft.entity.player.EntityPlayer#rayTrace() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FWBlock.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) {
	Block blockInstance = getBlockInstance(world, VectorConverter.instance().toNova(pos));
	MovingObjectPosition mop = player.rayTrace(10, 1);
	Block.LeftClickEvent evt = new Block.LeftClickEvent(EntityConverter.instance().toNova(player), DirectionConverter.instance().toNova(mop.sideHit), VectorConverter.instance().toNova(mop.hitVec));
	blockInstance.events.publish(evt);
}
 
Example 2
Source File: FWBlock.java    From NOVA-Core with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
	Block blockInstance = getBlockInstance(world, new Vector3D(x, y, z));
	MovingObjectPosition mop = player.rayTrace(10, 1);
	Block.LeftClickEvent evt = new Block.LeftClickEvent(EntityConverter.instance().toNova(player), Direction.fromOrdinal(mop.sideHit), new Vector3D(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord));
	blockInstance.events.publish(evt);
}