Java Code Examples for net.minecraft.command.ICommandSender#getPlayerCoordinates()

The following examples show how to use net.minecraft.command.ICommandSender#getPlayerCoordinates() . 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: CommandBaseAdv.java    From LookingGlass with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Returns the given ICommandSender as a EntityPlayer or throw an exception.
 */
public static TileEntity getCommandSenderAsTileEntity(ICommandSender sender) {
	try {
		World world = sender.getEntityWorld();
		ChunkCoordinates coords = sender.getPlayerCoordinates();
		return world.getTileEntity(coords.posX, coords.posY, coords.posZ);
	} catch (Exception e) {
		throw new CommandException("Could not get tile entity");
	}
}